fix: delete old auth token upon replacing primary email
This commit is contained in:
parent
9828aca733
commit
5ce1b564dc
1 changed files with 6 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"errors"
|
||||
"strings"
|
||||
|
||||
auth_model "forgejo.org/models/auth"
|
||||
"forgejo.org/models/db"
|
||||
user_model "forgejo.org/models/user"
|
||||
"forgejo.org/modules/setting"
|
||||
|
@ -171,6 +172,11 @@ func ReplaceInactivePrimaryEmail(ctx context.Context, oldEmail string, email *us
|
|||
return err
|
||||
}
|
||||
|
||||
// Delete previous activation token.
|
||||
if err := auth_model.DeleteAuthTokenByUser(ctx, user.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return DeleteEmailAddresses(ctx, user, []string{oldEmail})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue