Fix 10 linting errors
This commit is contained in:
@ -16,7 +16,7 @@ export const loginRouter = createTRPCRouter({
|
|||||||
.mutation(async ({ ctx, input }) => {
|
.mutation(async ({ ctx, input }) => {
|
||||||
// Encryption using bcrypt salt and pepper hashing
|
// Encryption using bcrypt salt and pepper hashing
|
||||||
const saltRounds = 10;
|
const saltRounds = 10;
|
||||||
let password_hash: string = "";
|
let password_hash = "";
|
||||||
|
|
||||||
bcrypt.hash(input.password, saltRounds, (err,hash) => {
|
bcrypt.hash(input.password, saltRounds, (err,hash) => {
|
||||||
password_hash = hash;
|
password_hash = hash;
|
||||||
@ -39,16 +39,16 @@ export const loginRouter = createTRPCRouter({
|
|||||||
// Encryption using bcrypt salt and pepper hashing
|
// Encryption using bcrypt salt and pepper hashing
|
||||||
const saltRounds = 10;
|
const saltRounds = 10;
|
||||||
// Get hash from database
|
// Get hash from database
|
||||||
let password_hash = ctx.UserModel.find({'username': input.username},'password');
|
const password_hash = ctx.UserModel.find({username: input.username},'password');
|
||||||
let is_valid: boolean = false;
|
let is_valid = false;
|
||||||
bcrypt.compare(input.password, password_hash, function(err, result) {
|
bcrypt.compare(input.password, password_hash, (err, result) => {
|
||||||
// returns result
|
// returns result
|
||||||
is_valid = result;
|
is_valid = result;
|
||||||
});
|
});
|
||||||
// Return for sign in
|
// Return for sign in
|
||||||
if(is_valid) {
|
if(is_valid) {
|
||||||
return {
|
return {
|
||||||
user: ctx.UserModel.find({'username': input.username}),
|
user: ctx.UserModel.find({username: input.username}),
|
||||||
success: true,
|
success: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user