mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
fixed vulnerabilities (#392)
This commit is contained in:
parent
d771e978a1
commit
b4c794058a
4 changed files with 37 additions and 12 deletions
|
@ -88,7 +88,14 @@ func UpdateAccessToken(t *AccessToken) error {
|
|||
}
|
||||
|
||||
// DeleteAccessTokenByID deletes access token by given ID.
|
||||
func DeleteAccessTokenByID(id int64) error {
|
||||
_, err := x.Id(id).Delete(new(AccessToken))
|
||||
return err
|
||||
func DeleteAccessTokenByID(id, userID int64) error {
|
||||
cnt, err := x.Id(id).Delete(&AccessToken{
|
||||
UID: userID,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
} else if cnt != 1 {
|
||||
return ErrAccessTokenNotExist{}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue