summaryrefslogtreecommitdiffstats
path: root/api/user.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-05-12 12:06:26 -0400
committerChristopher Speller <crspeller@gmail.com>2016-05-12 12:06:26 -0400
commit6631f28d92d68e4e39848038f7f263f8588aa2ac (patch)
tree315924951ba4adc4071e3fcecbc6404e9db4b16b /api/user.go
parent04dfa2a9eb50d60b2d4c2533f465799966b363a6 (diff)
downloadchat-6631f28d92d68e4e39848038f7f263f8588aa2ac.tar.gz
chat-6631f28d92d68e4e39848038f7f263f8588aa2ac.tar.bz2
chat-6631f28d92d68e4e39848038f7f263f8588aa2ac.zip
Improved handling of edge case where an LDAP user shares a username with a non-LDAP user (#2980)
Diffstat (limited to 'api/user.go')
-rw-r--r--api/user.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/api/user.go b/api/user.go
index 4b9c3a3c8..9e93ae779 100644
--- a/api/user.go
+++ b/api/user.go
@@ -494,8 +494,11 @@ func getUserForLogin(loginId string, onlyLdap bool) (*model.User, *model.AppErro
*utils.Cfg.EmailSettings.EnableSignInWithUsername && !onlyLdap,
*utils.Cfg.EmailSettings.EnableSignInWithEmail && !onlyLdap,
ldapAvailable,
- ); result.Err != nil {
-
+ ); result.Err != nil && result.Err.Id == "store.sql_user.get_for_login.multiple_users" {
+ // don't fall back to LDAP in this case since we already know there's an LDAP user, but that it shouldn't work
+ result.Err.StatusCode = http.StatusBadRequest
+ return nil, result.Err
+ } else if result.Err != nil {
if !ldapAvailable {
// failed to find user and no LDAP server to fall back on
result.Err.StatusCode = http.StatusBadRequest