feat : Change login password feature update
This commit is contained in:
@@ -48,14 +48,16 @@ async function setTpin(customerNo, tpin) {
|
|||||||
// Set login password
|
// Set login password
|
||||||
async function setLoginPassword(customerNo, login_psw) {
|
async function setLoginPassword(customerNo, login_psw) {
|
||||||
const hashedLoginPassword = await hashPassword(login_psw);
|
const hashedLoginPassword = await hashPassword(login_psw);
|
||||||
|
const currentTime = dayjs().toISOString();
|
||||||
|
const password_expiry = dayjs().add(90,"day").toISOString();
|
||||||
try {
|
try {
|
||||||
await db.query(
|
await db.query(
|
||||||
'UPDATE users SET password_hash = $1 ,is_first_login = false WHERE customer_no = $2',
|
'UPDATE users SET password_hash = $1 ,is_first_login = false,updated_at = $3,password_hash_expiry =$4 WHERE customer_no = $2',
|
||||||
[hashedLoginPassword, customerNo]
|
[hashedLoginPassword, customerNo ,currentTime ,password_expiry]
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`error occured while while setting new Login Password ${error.message}`
|
`error occurred while while setting new Login Password ${error.message}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user