Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a33b66

Browse files
committed
updated
1 parent1354405 commit0a33b66

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

‎controllers/auth.controller.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,19 +235,17 @@ func (ac *AuthController) ResetPassword(ctx *gin.Context) {
235235
passwordResetToken:=utils.Encode(resetToken)
236236

237237
varupdatedUser 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())
239239
ifresult.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"})
241241
return
242242
}
243243

244244
updatedUser.Password=hashedPassword
245245
updatedUser.PasswordResetToken=""
246246
ac.DB.Save(&updatedUser)
247247

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)
251249

252250
ctx.JSON(http.StatusOK, gin.H{"status":"success","message":"Password data updated successfully"})
253251
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp