diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2020-06-18 01:50:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-17 20:50:11 +0300 |
commit | 1645d4a5d8def3cc5451e068aa0a321e028a889b (patch) | |
tree | 99e1f29ec2dbb568cfee090ea4a2e49dfca02280 /models/login_source.go | |
parent | 61cd0ce86601a0bffb625ae27a7b76ee8a15cb36 (diff) | |
download | gitea-1645d4a5d8def3cc5451e068aa0a321e028a889b.tar.gz gitea-1645d4a5d8def3cc5451e068aa0a321e028a889b.zip |
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>
Diffstat (limited to 'models/login_source.go')
-rw-r--r-- | models/login_source.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/models/login_source.go b/models/login_source.go index 5350446233..1de24a9cf7 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -300,7 +300,7 @@ func (source *LoginSource) SSPI() *SSPIConfig { // CreateLoginSource inserts a LoginSource in the DB if not already // existing with the given name. func CreateLoginSource(source *LoginSource) error { - has, err := x.Get(&LoginSource{Name: source.Name}) + has, err := x.Where("name=?", source.Name).Exist(new(LoginSource)) if err != nil { return err } else if has { |