diff --git a/src/services/auth.service.js b/src/services/auth.service.js index 3ec7f00..52e448c 100644 --- a/src/services/auth.service.js +++ b/src/services/auth.service.js @@ -48,14 +48,16 @@ async function setTpin(customerNo, tpin) { // Set login password async function setLoginPassword(customerNo, login_psw) { const hashedLoginPassword = await hashPassword(login_psw); + const currentTime = dayjs().toISOString(); + const password_expiry = dayjs().add(90,"day").toISOString(); try { await db.query( - 'UPDATE users SET password_hash = $1 ,is_first_login = false WHERE customer_no = $2', - [hashedLoginPassword, customerNo] + 'UPDATE users SET password_hash = $1 ,is_first_login = false,updated_at = $3,password_hash_expiry =$4 WHERE customer_no = $2', + [hashedLoginPassword, customerNo ,currentTime ,password_expiry] ); } catch (error) { throw new Error( - `error occured while while setting new Login Password ${error.message}` + `error occurred while while setting new Login Password ${error.message}` ); } }