Skip to content

Commit

Permalink
Copy phone to user before saving.
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondap committed Apr 11, 2024
1 parent f4bd79d commit 2e8a298
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions web/webui/two_factor_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,19 @@ func UserComplete2FASetup(c *gin.Context) {
user.ConfirmedTwoFactor = false
}

user.PhoneNumber = prefs.NewPhone
user.AuthyStatus = prefs.NewMethod

// When turning off two factor, be sure to also clear AuthyStatus,
// or system will continue to expect to receive a second factor and
// user will be locked out. https://trello.com/c/UbYlbdyT
if prefs.DoNotUseTwoFactor() {
user.EnabledTwoFactor = false
user.AuthyStatus = ""
err = user.Save()
if AbortIfError(c, err) {
return
}
helpers.SetFlashCookie(c, "Two-factor authentication has been turned off for your account.")
c.Redirect(http.StatusFound, "/users/my_account")
return
Expand Down

0 comments on commit 2e8a298

Please sign in to comment.