diff options
author | 6543 <6543@obermui.de> | 2020-06-17 21:54:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 20:54:26 +0100 |
commit | dbe9c11238923d8442623fae5eddbac4226ebc96 (patch) | |
tree | 2d8fc6c450dd300b899788e1d45ac91cd19afc1f /models/twofactor.go | |
parent | 313ace93d048b13bdeba642c37e85175d68a6fc1 (diff) | |
download | gitea-dbe9c11238923d8442623fae5eddbac4226ebc96.tar.gz gitea-dbe9c11238923d8442623fae5eddbac4226ebc96.zip |
Use ID or Where to instead directly use Get when load object from database (#11925) (#11935)
Backport #11925
Use ID or Where to instead directly use Get when load object from database
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/twofactor.go')
-rw-r--r-- | models/twofactor.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/twofactor.go b/models/twofactor.go index 00a465353a..888c910b94 100644 --- a/models/twofactor.go +++ b/models/twofactor.go @@ -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 { |