[MM-53124] Add optional Forgot Password custom link to override the default flow on the login page (#23831)

* [MM-53124] Add optional Forgot Password custom link to override the default flow on the login page

* Fix i18n

* Fix test

* Added the enable/disable flag

* Fix test

* Fix e2e

* Add blockable link for the Customization navigation
Этот коммит содержится в:
Devin Binnie
2023-07-11 09:04:39 -04:00
коммит произвёл GitHub
родитель b59cba7e63
Коммит 116728424c
10 изменённых файлов: 161 добавлений и 48 удалений

Просмотреть файл

@@ -272,6 +272,7 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m
props["AboutLink"] = *c.SupportSettings.AboutLink
props["HelpLink"] = *c.SupportSettings.HelpLink
props["ReportAProblemLink"] = *c.SupportSettings.ReportAProblemLink
props["ForgotPasswordLink"] = *c.SupportSettings.ForgotPasswordLink
props["SupportEmail"] = *c.SupportSettings.SupportEmail
props["EnableAskCommunityLink"] = strconv.FormatBool(*c.SupportSettings.EnableAskCommunityLink)
@@ -295,6 +296,7 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m
props["PasswordRequireUppercase"] = strconv.FormatBool(*c.PasswordSettings.Uppercase)
props["PasswordRequireNumber"] = strconv.FormatBool(*c.PasswordSettings.Number)
props["PasswordRequireSymbol"] = strconv.FormatBool(*c.PasswordSettings.Symbol)
props["PasswordEnableForgotLink"] = strconv.FormatBool(*c.PasswordSettings.EnableForgotLink)
// Set default values for all options that require a license.
props["EnableCustomBrand"] = "false"

Просмотреть файл

@@ -1487,11 +1487,12 @@ func (s *NotificationLogSettings) GetAdvancedLoggingConfig() []byte {
}
type PasswordSettings struct {
MinimumLength *int `access:"authentication_password"`
Lowercase *bool `access:"authentication_password"`
Number *bool `access:"authentication_password"`
Uppercase *bool `access:"authentication_password"`
Symbol *bool `access:"authentication_password"`
MinimumLength *int `access:"authentication_password"`
Lowercase *bool `access:"authentication_password"`
Number *bool `access:"authentication_password"`
Uppercase *bool `access:"authentication_password"`
Symbol *bool `access:"authentication_password"`
EnableForgotLink *bool `access:"authentication_password"`
}
func (s *PasswordSettings) SetDefaults() {
@@ -1514,6 +1515,10 @@ func (s *PasswordSettings) SetDefaults() {
if s.Symbol == nil {
s.Symbol = NewBool(false)
}
if s.EnableForgotLink == nil {
s.EnableForgotLink = NewBool(true)
}
}
type FileSettings struct {
@@ -1882,6 +1887,7 @@ type SupportSettings struct {
AboutLink *string `access:"site_customization,write_restrictable,cloud_restrictable"`
HelpLink *string `access:"site_customization"`
ReportAProblemLink *string `access:"site_customization,write_restrictable,cloud_restrictable"`
ForgotPasswordLink *string `access:"site_customization,write_restrictable,cloud_restrictable"`
SupportEmail *string `access:"site_notifications"`
CustomTermsOfServiceEnabled *bool `access:"compliance_custom_terms_of_service"`
CustomTermsOfServiceReAcceptancePeriod *int `access:"compliance_custom_terms_of_service"`
@@ -1929,6 +1935,14 @@ func (s *SupportSettings) SetDefaults() {
s.ReportAProblemLink = NewString(SupportSettingsDefaultReportAProblemLink)
}
if !isSafeLink(s.ForgotPasswordLink) {
*s.ForgotPasswordLink = ""
}
if s.ForgotPasswordLink == nil {
s.ForgotPasswordLink = NewString("")
}
if s.SupportEmail == nil {
s.SupportEmail = NewString(SupportSettingsDefaultSupportEmail)
}

Просмотреть файл

@@ -115,7 +115,8 @@
"Lowercase": false,
"Number": false,
"Uppercase": false,
"Symbol": false
"Symbol": false,
"EnableForgotLink": true
},
"FileSettings": {
"EnableFileAttachments": true,
@@ -187,6 +188,7 @@
"AboutLink": "https://mattermost.com/default-about/",
"HelpLink": "https://mattermost.com/pl/help/",
"ReportAProblemLink": "https://mattermost.com/pl/report-a-bug",
"ForgotPasswordLink": "",
"SupportEmail": "feedback@mattermost.com"
},
"AnnouncementSettings": {