mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-03 23:46:14 +02:00
Unify password changing and invalidate auth tokens (#27625)
- Unify the password changing code - Invalidate existing auth tokens when changing passwords
This commit is contained in:
1 parent
f8b471ace1
commit
688d4a1f71
3 files changed
+20
-1
No files matched your search
@@ -54,6 +54,11 @@ func DeleteAuthTokenByID(ctx context.Context, id string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func DeleteAuthTokensByUserID(ctx context.Context, uid int64) error {
|
||||
_, err := db.GetEngine(ctx).Where(builder.Eq{"user_id": uid}).Delete(&AuthToken{})
|
||||
return err
|
||||
}
|
||||
|
||||
func DeleteExpiredAuthTokens(ctx context.Context) error {
|
||||
_, err := db.GetEngine(ctx).Where(builder.Lt{"expires_unix": timeutil.TimeStampNow()}).Delete(&AuthToken{})
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user