summaryrefslogtreecommitdiffstats
path: root/api/admin.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-07-29 10:09:22 -0400
committerChristopher Speller <crspeller@gmail.com>2016-07-29 10:09:22 -0400
commit56fd348123dbe51653996d1dab6fcf6613b5a94d (patch)
tree4f913f1ecb2f24be679cb24ffa4e32b8b370fb4d /api/admin.go
parent6f45bdd68b5a66f11893a151ae295ba1fb2c5cf5 (diff)
downloadchat-56fd348123dbe51653996d1dab6fcf6613b5a94d.tar.gz
chat-56fd348123dbe51653996d1dab6fcf6613b5a94d.tar.bz2
chat-56fd348123dbe51653996d1dab6fcf6613b5a94d.zip
PLT-3752 Changed email connection test to use the existing password if unchanged by client (#3685)
Diffstat (limited to 'api/admin.go')
-rw-r--r--api/admin.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/api/admin.go b/api/admin.go
index bd3955195..a50271f8b 100644
--- a/api/admin.go
+++ b/api/admin.go
@@ -195,6 +195,19 @@ func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ // if the user hasn't changed their email settings, fill in the actual SMTP password so that
+ // the user can verify an existing SMTP connection
+ if cfg.EmailSettings.SMTPPassword == model.FAKE_SETTING {
+ if cfg.EmailSettings.SMTPServer == utils.Cfg.EmailSettings.SMTPServer &&
+ cfg.EmailSettings.SMTPPort == utils.Cfg.EmailSettings.SMTPPort &&
+ cfg.EmailSettings.SMTPUsername == utils.Cfg.EmailSettings.SMTPUsername {
+ cfg.EmailSettings.SMTPPassword = utils.Cfg.EmailSettings.SMTPPassword
+ } else {
+ c.Err = model.NewLocAppError("testEmail", "api.admin.test_email.reenter_password", nil, "")
+ return
+ }
+ }
+
if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil {
c.Err = result.Err
return