forked from forgejo/forgejo
Use ID or Where to instead directly use Get when load object from database (#11925)
* Use ID or Where to instead directly use Get when load object from database * Apply suggestions from code review Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
61cd0ce866
commit
1645d4a5d8
9 changed files with 25 additions and 28 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue