From 1755025e7f5e3b9b4fd46e37a5d74f8e192f7bd2 Mon Sep 17 00:00:00 2001 From: Jon Lundy Date: Sun, 21 May 2017 00:14:28 -0600 Subject: [PATCH] models/login_source: add check for user for create/update on LDAP (#4405) * Add check for user for create/update * Update login_source.go * Update login_source.go --- models/login_source.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/models/login_source.go b/models/login_source.go index 03e6d6a3a..9da9ff943 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -327,6 +327,16 @@ func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoR IsActive: true, IsAdmin: isAdmin, } + + ok, err := IsUserExist(0, user.Name) + if err != nil { + return user, err + } + + if ok { + return user, UpdateUser(user) + } + return user, CreateUser(user) }