summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/config.go41
-rw-r--r--utils/mail.go2
2 files changed, 33 insertions, 10 deletions
diff --git a/utils/config.go b/utils/config.go
index 46daf203c..36193412b 100644
--- a/utils/config.go
+++ b/utils/config.go
@@ -31,6 +31,7 @@ type ServiceSettings struct {
UseLocalStorage bool
StorageDirectory string
AllowedLoginAttempts int
+ AllowEmailSignUp bool
}
type SSOSetting struct {
@@ -109,16 +110,18 @@ type PrivacySettings struct {
}
type TeamSettings struct {
- MaxUsersPerTeam int
- AllowPublicLink bool
- AllowValetDefault bool
- TermsLink string
- PrivacyLink string
- AboutLink string
- HelpLink string
- ReportProblemLink string
- TourLink string
- DefaultThemeColor string
+ MaxUsersPerTeam int
+ AllowPublicLink bool
+ AllowValetDefault bool
+ TermsLink string
+ PrivacyLink string
+ AboutLink string
+ HelpLink string
+ ReportProblemLink string
+ TourLink string
+ DefaultThemeColor string
+ DisableTeamCreation bool
+ RestrictCreationToDomains string
}
type Config struct {
@@ -275,5 +278,23 @@ func GetAllowedAuthServices() []string {
}
}
+ if Cfg.ServiceSettings.AllowEmailSignUp {
+ authServices = append(authServices, "email")
+ }
+
return authServices
}
+
+func IsServiceAllowed(s string) bool {
+ if len(s) == 0 {
+ return false
+ }
+
+ if service, ok := Cfg.SSOSettings[s]; ok {
+ if service.Allow {
+ return true
+ }
+ }
+
+ return false
+}
diff --git a/utils/mail.go b/utils/mail.go
index 783a2de8c..7cb178626 100644
--- a/utils/mail.go
+++ b/utils/mail.go
@@ -12,6 +12,7 @@ import (
"net"
"net/mail"
"net/smtp"
+ "time"
)
func CheckMailSettings() *model.AppError {
@@ -101,6 +102,7 @@ func SendMail(to, subject, body string) *model.AppError {
headers["Subject"] = html.UnescapeString(subject)
headers["MIME-version"] = "1.0"
headers["Content-Type"] = "text/html"
+ headers["Date"] = time.Now().Format(time.RFC1123Z)
message := ""
for k, v := range headers {