PLT-3752 Changed email connection test to use the existing password if unchanged by client (#3685)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
6f45bdd68b
Коммит
56fd348123
13
api/admin.go
13
api/admin.go
@@ -195,6 +195,19 @@ func testEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
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 {
|
if result := <-Srv.Store.User().Get(c.Session.UserId); result.Err != nil {
|
||||||
c.Err = result.Err
|
c.Err = result.Err
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -103,6 +103,10 @@
|
|||||||
"id": "api.admin.test_email.missing_server",
|
"id": "api.admin.test_email.missing_server",
|
||||||
"translation": "SMTP Server is required"
|
"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",
|
"id": "api.admin.test_email.subject",
|
||||||
"translation": "Mattermost - Testing Email Settings"
|
"translation": "Mattermost - Testing Email Settings"
|
||||||
|
|||||||
@@ -46,9 +46,14 @@ export default class EmailConnectionTestButton extends React.Component {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
|
let fail = err.message;
|
||||||
|
if (err.detailed_error) {
|
||||||
|
fail += ' - ' + err.detailed_error;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
testing: false,
|
testing: false,
|
||||||
fail: err.message + ' - ' + err.detailed_error
|
fail
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user