code formatting in auth.service
This commit is contained in:
@@ -48,10 +48,10 @@ async function setTpin(customerNo, tpin) {
|
||||
async function setLoginPassword(customerNo, login_psw) {
|
||||
const hashedLoginPassword = await hashPassword(login_psw);
|
||||
try {
|
||||
await db.query('UPDATE users SET password_hash = $1 ,is_first_login = false WHERE customer_no = $2', [
|
||||
hashedLoginPassword,
|
||||
customerNo,
|
||||
]);
|
||||
await db.query(
|
||||
'UPDATE users SET password_hash = $1 ,is_first_login = false WHERE customer_no = $2',
|
||||
[hashedLoginPassword, customerNo]
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`error occured while while setting new Login Password ${error.message}`
|
||||
@@ -62,7 +62,7 @@ async function setLoginPassword(customerNo, login_psw) {
|
||||
async function validateTransactionPassword(customerNo, tpassword) {
|
||||
const user = await findUserByCustomerNo(customerNo);
|
||||
if (!user?.transaction_password) return null;
|
||||
const isMatch = await comparePassword(tpassword, user.transaction_password );
|
||||
const isMatch = await comparePassword(tpassword, user.transaction_password);
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ async function validateTransactionPassword(customerNo, tpassword) {
|
||||
async function setTransactionPassword(customerNo, trans_psw) {
|
||||
const hashedTransPassword = await hashPassword(trans_psw);
|
||||
try {
|
||||
await db.query('UPDATE users SET transaction_password = $1 WHERE customer_no = $2', [
|
||||
hashedTransPassword,
|
||||
customerNo,
|
||||
]);
|
||||
await db.query(
|
||||
'UPDATE users SET transaction_password = $1 WHERE customer_no = $2',
|
||||
[hashedTransPassword, customerNo]
|
||||
);
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`error occured while while setting new Transaction Password ${error.message}`
|
||||
@@ -81,5 +81,13 @@ async function setTransactionPassword(customerNo, trans_psw) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { validateUser, findUserByCustomerNo, setTpin, validateTpin,
|
||||
CheckFirstTimeLogin, setLoginPassword, validateTransactionPassword,setTransactionPassword };
|
||||
module.exports = {
|
||||
validateUser,
|
||||
findUserByCustomerNo,
|
||||
setTpin,
|
||||
validateTpin,
|
||||
CheckFirstTimeLogin,
|
||||
setLoginPassword,
|
||||
validateTransactionPassword,
|
||||
setTransactionPassword,
|
||||
};
|
||||
|
Reference in New Issue
Block a user