Merge pull request #187 from Kirari04/main

fix missing / unnecessary error check
This commit is contained in:
Toby Chui 2024-06-07 01:14:14 +08:00 committed by GitHub
commit aa96d831e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -272,17 +272,14 @@ func HandleNewPasswordSetup(w http.ResponseWriter, r *http.Request) {
return
}
//Delete the user account
authAgent.UnregisterUser(username)
//Ok. Set the new password
err = authAgent.CreateUserAccount(username, newPassword, "")
if err != nil {
// Un register the user account
if err := authAgent.UnregisterUser(username); err != nil {
utils.SendErrorResponse(w, err.Error())
return
}
if err != nil {
//Ok. Set the new password
if err := authAgent.CreateUserAccount(username, newPassword, ""); err != nil {
utils.SendErrorResponse(w, err.Error())
return
}