diff options
-rw-r--r-- | api/team.go | 5 | ||||
-rw-r--r-- | utils/config.go | 1 | ||||
-rw-r--r-- | utils/mail.go | 23 | ||||
-rw-r--r-- | web/react/components/navbar_dropdown.jsx | 2 | ||||
-rw-r--r-- | web/react/components/sidebar_right_menu.jsx | 15 | ||||
-rw-r--r-- | web/react/components/user_settings/user_settings_notifications.jsx | 2 | ||||
-rw-r--r-- | web/react/utils/utils.jsx | 8 |
7 files changed, 52 insertions, 4 deletions
diff --git a/api/team.go b/api/team.go index 4794b66df..fba4b41c6 100644 --- a/api/team.go +++ b/api/team.go @@ -75,7 +75,10 @@ func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) { return } - m["follow_link"] = bodyPage.Props["Link"] + if !utils.Cfg.EmailSettings.RequireEmailVerification { + m["follow_link"] = bodyPage.Props["Link"] + } + w.Header().Set("Access-Control-Allow-Origin", " *") w.Write([]byte(model.MapToJson(m))) } diff --git a/utils/config.go b/utils/config.go index b405f50b9..3218211e3 100644 --- a/utils/config.go +++ b/utils/config.go @@ -155,6 +155,7 @@ func LoadConfig(fileName string) { } configureLog(&config.LogSettings) + TestConnection(&config) Cfg = &config SanitizeOptions = getSanitizeOptions(Cfg) diff --git a/utils/mail.go b/utils/mail.go index dd975155d..f6fe1ce00 100644 --- a/utils/mail.go +++ b/utils/mail.go @@ -65,13 +65,34 @@ func newSMTPClient(conn net.Conn, config *model.Config) (*smtp.Client, *model.Ap return c, nil } +func TestConnection(config *model.Config) { + if !config.EmailSettings.SendEmailNotifications { + return + } + + conn, err1 := connectToSMTPServer(config) + if err1 != nil { + l4g.Error("SMTP server settings do not appear to be configured properly err=%v details=%v", err1.Message, err1.DetailedError) + return + } + defer conn.Close() + + c, err2 := newSMTPClient(conn, config) + if err2 != nil { + l4g.Error("SMTP connection settings do not appear to be configured properly err=%v details=%v", err2.Message, err2.DetailedError) + return + } + defer c.Quit() + defer c.Close() +} + func SendMail(to, subject, body string) *model.AppError { return SendMailUsingConfig(to, subject, body, Cfg) } func SendMailUsingConfig(to, subject, body string, config *model.Config) *model.AppError { - if !config.EmailSettings.SendEmailNotifications { + if !config.EmailSettings.SendEmailNotifications || len(config.EmailSettings.SMTPServer) == 0 { return nil } diff --git a/web/react/components/navbar_dropdown.jsx b/web/react/components/navbar_dropdown.jsx index 4c01d2c43..57a78a0d4 100644 --- a/web/react/components/navbar_dropdown.jsx +++ b/web/react/components/navbar_dropdown.jsx @@ -62,7 +62,7 @@ export default class NavbarDropdown extends React.Component { if (currentUser != null) { isAdmin = Utils.isAdmin(currentUser.roles); - isSystemAdmin = Utils.isInRole(currentUser.roles, 'system_admin'); + isSystemAdmin = Utils.isSystemAdmin(currentUser.roles); inviteLink = ( <li> diff --git a/web/react/components/sidebar_right_menu.jsx b/web/react/components/sidebar_right_menu.jsx index f1341d9d7..2df2c8ffd 100644 --- a/web/react/components/sidebar_right_menu.jsx +++ b/web/react/components/sidebar_right_menu.jsx @@ -26,11 +26,14 @@ export default class SidebarRightMenu extends React.Component { var inviteLink = ''; var teamSettingsLink = ''; var manageLink = ''; + var consoleLink = ''; var currentUser = UserStore.getCurrentUser(); var isAdmin = false; + var isSystemAdmin = false; if (currentUser != null) { isAdmin = utils.isAdmin(currentUser.roles); + isSystemAdmin = utils.isSystemAdmin(currentUser.roles); inviteLink = ( <li> @@ -77,6 +80,17 @@ export default class SidebarRightMenu extends React.Component { ); } + if (isSystemAdmin) { + consoleLink = ( + <li> + <a + href='/admin_console' + > + <i className='glyphicon glyphicon-wrench'></i>System Console</a> + </li> + ); + } + var siteName = ''; if (global.window.config.SiteName != null) { siteName = global.window.config.SiteName; @@ -107,6 +121,7 @@ export default class SidebarRightMenu extends React.Component { {inviteLink} {teamLink} {manageLink} + {consoleLink} <li> <a href='#' diff --git a/web/react/components/user_settings/user_settings_notifications.jsx b/web/react/components/user_settings/user_settings_notifications.jsx index ba14f019f..42c65ef5d 100644 --- a/web/react/components/user_settings/user_settings_notifications.jsx +++ b/web/react/components/user_settings/user_settings_notifications.jsx @@ -420,7 +420,7 @@ export default class NotificationsTab extends React.Component { </label> <br/> </div> - <div><br/>{'Email notifications are sent for mentions and direct messages after you have been away from ' + global.window.config.SiteName + ' for 5 minutes.'}</div> + <div><br/>{'Email notifications are sent for mentions and direct messages after you’ve been offline for more than 60 seconds or away from ' + global.window.config.SiteName + ' for more than 5 minutes.'}</div> </div> ); diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index ad4575c6e..91e47730e 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -78,6 +78,14 @@ export function isAdmin(roles) { return false; } +export function isSystemAdmin(roles) { + if (isInRole(roles, 'system_admin')) { + return true; + } + + return false; +} + export function getDomainWithOutSub() { var parts = window.location.host.split('.'); |