summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/admin.go13
-rw-r--r--i18n/en.json4
-rw-r--r--webapp/components/admin_console/email_connection_test.jsx7
3 files changed, 23 insertions, 1 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
diff --git a/i18n/en.json b/i18n/en.json
index 3937e5514..5fad6d452 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -104,6 +104,10 @@
"translation": "SMTP Server is required"
},
{
+ "id": "api.admin.test_email.reenter_password",
+ "translation": "The SMTP server, port, or username has changed. Please re-enter the SMTP password to test connection."
+ },
+ {
"id": "api.admin.test_email.subject",
"translation": "Mattermost - Testing Email Settings"
},
diff --git a/webapp/components/admin_console/email_connection_test.jsx b/webapp/components/admin_console/email_connection_test.jsx
index c66543bbf..7713f0960 100644
--- a/webapp/components/admin_console/email_connection_test.jsx
+++ b/webapp/components/admin_console/email_connection_test.jsx
@@ -46,9 +46,14 @@ export default class EmailConnectionTestButton extends React.Component {
});
},
(err) => {
+ let fail = err.message;
+ if (err.detailed_error) {
+ fail += ' - ' + err.detailed_error;
+ }
+
this.setState({
testing: false,
- fail: err.message + ' - ' + err.detailed_error
+ fail
});
}
);