mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-06 10:17:37 +02:00
Backport #11925 Use ID or Where to instead directly use Get when load object from database Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
1 parent
47a5c8e1f7
commit
ecad970a26
9 files changed
+25
-28
No files matched your search
+2
-2
@@ -142,8 +142,8 @@ func UpdateTwoFactor(t *TwoFactor) error {
|
||||
// GetTwoFactorByUID returns the two-factor authentication token associated with
|
||||
// the user, if any.
|
||||
func GetTwoFactorByUID(uid int64) (*TwoFactor, error) {
|
||||
twofa := &TwoFactor{UID: uid}
|
||||
has, err := x.Get(twofa)
|
||||
twofa := &TwoFactor{}
|
||||
has, err := x.Where("uid=?", uid).Get(twofa)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
|
||||
Reference in new issue
Block a user