@@ -235,19 +235,17 @@ func (ac *AuthController) ResetPassword(ctx *gin.Context) {
235
235
passwordResetToken := utils .Encode (resetToken )
236
236
237
237
var updatedUser models.User
238
- result := ac .DB .First (& updatedUser ,"password_reset_token = ?" ,passwordResetToken )
238
+ result := ac .DB .First (& updatedUser ,"password_reset_token = ? AND password_reset_at > ? " ,passwordResetToken , time . Now () )
239
239
if result .Error != nil {
240
- ctx .JSON (http .StatusBadRequest , gin.H {"status" :"fail" ,"message" :"Invalid verification code or user doesn't exists " })
240
+ ctx .JSON (http .StatusBadRequest , gin.H {"status" :"fail" ,"message" :"The reset token is invalid or has expired " })
241
241
return
242
242
}
243
243
244
244
updatedUser .Password = hashedPassword
245
245
updatedUser .PasswordResetToken = ""
246
246
ac .DB .Save (& updatedUser )
247
247
248
- ctx .SetCookie ("access_token" ,"" ,- 1 ,"/" ,"localhost" ,false ,true )
249
- ctx .SetCookie ("refresh_token" ,"" ,- 1 ,"/" ,"localhost" ,false ,true )
250
- ctx .SetCookie ("logged_in" ,"" ,- 1 ,"/" ,"localhost" ,false ,true )
248
+ ctx .SetCookie ("token" ,"" ,- 1 ,"/" ,"localhost" ,false ,true )
251
249
252
250
ctx .JSON (http .StatusOK , gin.H {"status" :"success" ,"message" :"Password data updated successfully" })
253
251
}