diff options
author | Earl Warren <contact@earl-warren.org> | 2024-02-05 14:43:35 +0100 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-02-05 14:43:35 +0100 |
commit | 1951c51c8e087b92a981f71a7214198e1ca5ae84 (patch) | |
tree | 4d3ab1bae1e3e6c637288b3d077dc67eda0f4d87 /services | |
parent | [CI] Forgejo Actions based CI (squash) all queues are immediate (diff) | |
download | forgejo-1951c51c8e087b92a981f71a7214198e1ca5ae84.tar.xz forgejo-1951c51c8e087b92a981f71a7214198e1ca5ae84.zip |
Revert "Unify password changing and invalidate auth tokens (#27625)"
This reverts commit 688d4a1f719d2df4d2626453f4bc042c1874a375.
Diffstat (limited to 'services')
-rw-r--r-- | services/user/delete.go | 4 | ||||
-rw-r--r-- | services/user/update.go | 12 |
2 files changed, 1 insertions, 15 deletions
diff --git a/services/user/delete.go b/services/user/delete.go index 000910319a..0e9c866171 100644 --- a/services/user/delete.go +++ b/services/user/delete.go @@ -187,10 +187,6 @@ func deleteUser(ctx context.Context, u *user_model.User, purge bool) (err error) } // ***** END: ExternalLoginUser ***** - if err := auth_model.DeleteAuthTokensByUserID(ctx, u.ID); err != nil { - return fmt.Errorf("DeleteAuthTokensByUserID: %w", err) - } - if _, err = db.DeleteByID[user_model.User](ctx, u.ID); err != nil { return fmt.Errorf("delete: %w", err) } diff --git a/services/user/update.go b/services/user/update.go index cbaf90053a..849757c8b0 100644 --- a/services/user/update.go +++ b/services/user/update.go @@ -183,7 +183,6 @@ func UpdateAuth(ctx context.Context, u *user_model.User, opts *UpdateAuthOptions u.LoginName = opts.LoginName.Value() } - deleteAuthTokens := false if opts.Password.Has() && (u.IsLocal() || u.IsOAuth2()) { password := opts.Password.Value() @@ -200,8 +199,6 @@ func UpdateAuth(ctx context.Context, u *user_model.User, opts *UpdateAuthOptions if err := u.SetPassword(password); err != nil { return err } - - deleteAuthTokens = true } if opts.MustChangePassword.Has() { @@ -211,12 +208,5 @@ func UpdateAuth(ctx context.Context, u *user_model.User, opts *UpdateAuthOptions u.ProhibitLogin = opts.ProhibitLogin.Value() } - if err := user_model.UpdateUserCols(ctx, u, "login_type", "login_source", "login_name", "passwd", "passwd_hash_algo", "salt", "must_change_password", "prohibit_login"); err != nil { - return err - } - - if deleteAuthTokens { - return auth_model.DeleteAuthTokensByUserID(ctx, u.ID) - } - return nil + return user_model.UpdateUserCols(ctx, u, "login_type", "login_source", "login_name", "passwd", "passwd_hash_algo", "salt", "must_change_password", "prohibit_login") } |