diff --git a/api/admin.go b/api/admin.go index d4af1d247f..6d7a9028f2 100644 --- a/api/admin.go +++ b/api/admin.go @@ -20,6 +20,7 @@ func InitAdmin(r *mux.Router) { sr := r.PathPrefix("/admin").Subrouter() sr.Handle("/logs", ApiUserRequired(getLogs)).Methods("GET") + sr.Handle("/client_props", ApiAppHandler(getClientProperties)).Methods("GET") } func getLogs(c *Context, w http.ResponseWriter, r *http.Request) { @@ -49,3 +50,7 @@ func getLogs(c *Context, w http.ResponseWriter, r *http.Request) { w.Write([]byte(model.ArrayToJson(lines))) } + +func getClientProperties(c *Context, w http.ResponseWriter, r *http.Request) { + w.Write([]byte(model.MapToJson(utils.ClientProperties))) +} diff --git a/api/admin_test.go b/api/admin_test.go index 460ac1208b..e67077c555 100644 --- a/api/admin_test.go +++ b/api/admin_test.go @@ -33,3 +33,12 @@ func TestGetLogs(t *testing.T) { t.Fatal() } } + +func TestGetClientProperties(t *testing.T) { + Setup() + + if _, err := Client.GetClientProperties(); err != nil { + + t.Fatal(err) + } +} diff --git a/api/api.go b/api/api.go index 35ac0bdc02..10f3deb82b 100644 --- a/api/api.go +++ b/api/api.go @@ -16,10 +16,12 @@ var ServerTemplates *template.Template type ServerTemplatePage Page -func NewServerTemplatePage(templateName, siteURL string) *ServerTemplatePage { - props := make(map[string]string) - props["AnalyticsUrl"] = utils.Cfg.ServiceSettings.AnalyticsUrl - return &ServerTemplatePage{TemplateName: templateName, SiteName: utils.Cfg.ServiceSettings.SiteName, FeedbackEmail: utils.Cfg.EmailSettings.FeedbackEmail, SiteURL: siteURL, Props: props} +func NewServerTemplatePage(templateName string) *ServerTemplatePage { + return &ServerTemplatePage{ + TemplateName: templateName, + Props: make(map[string]string), + ClientProps: utils.ClientProperties, + } } func (me *ServerTemplatePage) Render() string { diff --git a/api/context.go b/api/context.go index fc7d8f23d1..313eec1892 100644 --- a/api/context.go +++ b/api/context.go @@ -29,12 +29,9 @@ type Context struct { } type Page struct { - TemplateName string - Title string - SiteName string - FeedbackEmail string - SiteURL string - Props map[string]string + TemplateName string + Props map[string]string + ClientProps map[string]string } func ApiAppHandler(h func(*Context, http.ResponseWriter, *http.Request)) http.Handler { diff --git a/api/post.go b/api/post.go index bd31e0210a..005f3f8843 100644 --- a/api/post.go +++ b/api/post.go @@ -378,7 +378,8 @@ func fireAndForgetNotifications(post *model.Post, teamId, siteURL string) { location, _ := time.LoadLocation("UTC") tm := time.Unix(post.CreateAt/1000, 0).In(location) - subjectPage := NewServerTemplatePage("post_subject", siteURL) + subjectPage := NewServerTemplatePage("post_subject") + subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName subjectPage.Props["SubjectText"] = subjectText subjectPage.Props["Month"] = tm.Month().String()[:3] @@ -396,7 +397,8 @@ func fireAndForgetNotifications(post *model.Post, teamId, siteURL string) { continue } - bodyPage := NewServerTemplatePage("post_body", siteURL) + bodyPage := NewServerTemplatePage("post_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["Nickname"] = profileMap[id].FirstName bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["ChannelName"] = channelName diff --git a/api/team.go b/api/team.go index 8258fa9290..44f86b1603 100644 --- a/api/team.go +++ b/api/team.go @@ -56,8 +56,10 @@ func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) { return } - subjectPage := NewServerTemplatePage("signup_team_subject", c.GetSiteURL()) - bodyPage := NewServerTemplatePage("signup_team_body", c.GetSiteURL()) + subjectPage := NewServerTemplatePage("signup_team_subject") + subjectPage.Props["SiteURL"] = c.GetSiteURL() + bodyPage := NewServerTemplatePage("signup_team_body") + bodyPage.Props["SiteURL"] = c.GetSiteURL() bodyPage.Props["TourUrl"] = utils.Cfg.TeamSettings.TourLink props := make(map[string]string) @@ -401,8 +403,10 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) { return } - subjectPage := NewServerTemplatePage("find_teams_subject", c.GetSiteURL()) - bodyPage := NewServerTemplatePage("find_teams_body", c.GetSiteURL()) + subjectPage := NewServerTemplatePage("find_teams_subject") + subjectPage.Props["SiteURL"] = c.GetSiteURL() + bodyPage := NewServerTemplatePage("find_teams_body") + bodyPage.Props["SiteURL"] = c.GetSiteURL() if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil { c.Err = result.Err @@ -483,16 +487,17 @@ func InviteMembers(c *Context, team *model.Team, user *model.User, invites []str senderRole = "member" } - subjectPage := NewServerTemplatePage("invite_subject", c.GetSiteURL()) + subjectPage := NewServerTemplatePage("invite_subject") + subjectPage.Props["SiteURL"] = c.GetSiteURL() subjectPage.Props["SenderName"] = sender subjectPage.Props["TeamDisplayName"] = team.DisplayName - bodyPage := NewServerTemplatePage("invite_body", c.GetSiteURL()) + + bodyPage := NewServerTemplatePage("invite_body") + bodyPage.Props["SiteURL"] = c.GetSiteURL() bodyPage.Props["TeamDisplayName"] = team.DisplayName bodyPage.Props["SenderName"] = sender bodyPage.Props["SenderStatus"] = senderRole - bodyPage.Props["Email"] = invite - props := make(map[string]string) props["email"] = invite props["id"] = team.Id diff --git a/api/templates/email_change_body.html b/api/templates/email_change_body.html index c4e1cf39d9..3f041d09de 100644 --- a/api/templates/email_change_body.html +++ b/api/templates/email_change_body.html @@ -9,7 +9,7 @@ @@ -25,7 +25,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -34,7 +34,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/error.html b/api/templates/error.html index adb8f9f7d9..cac46e2236 100644 --- a/api/templates/error.html +++ b/api/templates/error.html @@ -1,7 +1,7 @@ - {{ .SiteName }} - Error + {{ .ClientProps.SiteName }} - Error @@ -12,9 +12,9 @@

-

{{ .SiteName }} needs your help:

+

{{ .ClientProps.SiteName }} needs your help:

{{.Message}}

- Go back to team site + Go back to team site
diff --git a/api/templates/find_teams_body.html b/api/templates/find_teams_body.html index 00c5628dd2..fe134811a8 100644 --- a/api/templates/find_teams_body.html +++ b/api/templates/find_teams_body.html @@ -9,7 +9,7 @@ @@ -33,7 +33,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -42,7 +42,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/find_teams_subject.html b/api/templates/find_teams_subject.html index e5ba2d23fa..3c2bef5891 100644 --- a/api/templates/find_teams_subject.html +++ b/api/templates/find_teams_subject.html @@ -1 +1 @@ -{{define "find_teams_subject"}}Your {{ .SiteName }} Teams{{end}} +{{define "find_teams_subject"}}Your {{ .ClientProps.SiteName }} Teams{{end}} diff --git a/api/templates/invite_body.html b/api/templates/invite_body.html index 568a0d8930..401111b75c 100644 --- a/api/templates/invite_body.html +++ b/api/templates/invite_body.html @@ -9,7 +9,7 @@ @@ -18,7 +18,7 @@
- +

You've been invited

-

{{.Props.TeamDisplayName}} started using {{.SiteName}}.
The team {{.Props.SenderStatus}} {{.Props.SenderName}}, has invited you to join {{.Props.TeamDisplayName}}.

+

{{.Props.TeamDisplayName}} started using {{.ClientProps.SiteName}}.
The team {{.Props.SenderStatus}} {{.Props.SenderName}}, has invited you to join {{.Props.TeamDisplayName}}.

Join Team

@@ -28,7 +28,7 @@
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/invite_subject.html b/api/templates/invite_subject.html index 6a1e57dcca..f46bdcfaf2 100644 --- a/api/templates/invite_subject.html +++ b/api/templates/invite_subject.html @@ -1 +1 @@ -{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.SiteName}}{{end}} +{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.ClientProps.SiteName}}{{end}} diff --git a/api/templates/password_change_body.html b/api/templates/password_change_body.html index 6fc9f28226..6a32e89dba 100644 --- a/api/templates/password_change_body.html +++ b/api/templates/password_change_body.html @@ -9,7 +9,7 @@ @@ -25,7 +25,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -34,7 +34,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/password_change_subject.html b/api/templates/password_change_subject.html index 55daefdb1c..283fda1afd 100644 --- a/api/templates/password_change_subject.html +++ b/api/templates/password_change_subject.html @@ -1 +1 @@ -{{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .SiteName }}{{end}} +{{define "password_change_subject"}}You updated your password for {{.Props.TeamDisplayName}} on {{ .ClientProps.SiteName }}{{end}} diff --git a/api/templates/post_body.html b/api/templates/post_body.html index a1df5b4c97..0c906807a0 100644 --- a/api/templates/post_body.html +++ b/api/templates/post_body.html @@ -9,7 +9,7 @@ @@ -28,7 +28,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/post_subject.html b/api/templates/post_subject.html index 7d8941549a..944cd5a42a 100644 --- a/api/templates/post_subject.html +++ b/api/templates/post_subject.html @@ -1 +1 @@ -{{define "post_subject"}}[{{.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}} +{{define "post_subject"}}[{{.ClientProps.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}} diff --git a/api/templates/reset_body.html b/api/templates/reset_body.html index a6e6269c06..3e4938a09b 100644 --- a/api/templates/reset_body.html +++ b/api/templates/reset_body.html @@ -9,7 +9,7 @@ @@ -28,7 +28,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/signup_team_body.html b/api/templates/signup_team_body.html index b49cf5f369..ef58aa92c1 100644 --- a/api/templates/signup_team_body.html +++ b/api/templates/signup_team_body.html @@ -9,7 +9,7 @@ @@ -21,7 +21,7 @@

Set up your team

- {{ .SiteName }} is one place for all your team communication, searchable and available anywhere.
You'll get more out of {{ .SiteName }} when your team is in constant communication--let's get them on board.

+ {{ .ClientProps.SiteName }} is one place for all your team communication, searchable and available anywhere.
You'll get more out of {{ .ClientProps.SiteName }} when your team is in constant communication--let's get them on board.

Learn more by taking a tour

@@ -31,7 +31,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -40,7 +40,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/signup_team_subject.html b/api/templates/signup_team_subject.html index 1cd3427d21..7bc0cc640a 100644 --- a/api/templates/signup_team_subject.html +++ b/api/templates/signup_team_subject.html @@ -1 +1 @@ -{{define "signup_team_subject"}}Invitation to {{ .SiteName }}{{end}} \ No newline at end of file +{{define "signup_team_subject"}}Invitation to {{ .ClientProps.SiteName }}{{end}} \ No newline at end of file diff --git a/api/templates/verify_body.html b/api/templates/verify_body.html index 6ba11d845e..ac60e4fada 100644 --- a/api/templates/verify_body.html +++ b/api/templates/verify_body.html @@ -9,7 +9,7 @@ @@ -28,7 +28,7 @@
- +
Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -37,7 +37,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/verify_subject.html b/api/templates/verify_subject.html index a661507356..7990df84ae 100644 --- a/api/templates/verify_subject.html +++ b/api/templates/verify_subject.html @@ -1 +1 @@ -{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .SiteName }}] Email Verification{{end}} +{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .ClientProps.SiteName }}] Email Verification{{end}} diff --git a/api/templates/welcome_body.html b/api/templates/welcome_body.html index f16f50e146..4d4f03a2da 100644 --- a/api/templates/welcome_body.html +++ b/api/templates/welcome_body.html @@ -9,7 +9,7 @@ @@ -17,15 +17,15 @@
- +
-

You joined the {{.Props.TeamDisplayName}} team at {{.SiteName}}!

-

Please let me know if you have any questions.
Enjoy your stay at {{.SiteName}}.

+

You joined the {{.Props.TeamDisplayName}} team at {{.ClientProps.SiteName}}!

+

Please let me know if you have any questions.
Enjoy your stay at {{.ClientProps.SiteName}}.

Any questions at all, mail us any time: {{.FeedbackEmail}}.
Best wishes,
- The {{.SiteName}} Team
+ The {{.ClientProps.SiteName}} Team
@@ -34,7 +34,7 @@

- +

(c) 2015 SpinPunch, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.
diff --git a/api/templates/welcome_subject.html b/api/templates/welcome_subject.html index 106cc3ae6f..2214f7a382 100644 --- a/api/templates/welcome_subject.html +++ b/api/templates/welcome_subject.html @@ -1 +1 @@ -{{define "welcome_subject"}}Welcome to {{ .SiteName }}{{end}} \ No newline at end of file +{{define "welcome_subject"}}Welcome to {{ .ClientProps.SiteName }}{{end}} \ No newline at end of file diff --git a/api/user.go b/api/user.go index c87b89c7a2..cdd9a68be8 100644 --- a/api/user.go +++ b/api/user.go @@ -216,8 +216,10 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User { func fireAndForgetWelcomeEmail(name, email, teamDisplayName, link, siteURL string) { go func() { - subjectPage := NewServerTemplatePage("welcome_subject", siteURL) - bodyPage := NewServerTemplatePage("welcome_body", siteURL) + subjectPage := NewServerTemplatePage("welcome_subject") + subjectPage.Props["SiteURL"] = siteURL + bodyPage := NewServerTemplatePage("welcome_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["Nickname"] = name bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["FeedbackName"] = utils.Cfg.EmailSettings.FeedbackName @@ -235,9 +237,11 @@ func FireAndForgetVerifyEmail(userId, userEmail, teamName, teamDisplayName, site link := fmt.Sprintf("%s/verify_email?uid=%s&hid=%s&teamname=%s&email=%s", siteURL, userId, model.HashPassword(userId), teamName, userEmail) - subjectPage := NewServerTemplatePage("verify_subject", siteURL) + subjectPage := NewServerTemplatePage("verify_subject") + subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName - bodyPage := NewServerTemplatePage("verify_body", siteURL) + bodyPage := NewServerTemplatePage("verify_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["VerifyUrl"] = link @@ -1133,8 +1137,10 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) { link := fmt.Sprintf("%s/reset_password?d=%s&h=%s", c.GetTeamURLFromTeam(team), url.QueryEscape(data), url.QueryEscape(hash)) - subjectPage := NewServerTemplatePage("reset_subject", c.GetSiteURL()) - bodyPage := NewServerTemplatePage("reset_body", c.GetSiteURL()) + subjectPage := NewServerTemplatePage("reset_subject") + subjectPage.Props["SiteURL"] = c.GetSiteURL() + bodyPage := NewServerTemplatePage("reset_body") + bodyPage.Props["SiteURL"] = c.GetSiteURL() bodyPage.Props["ResetUrl"] = link if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil { @@ -1233,9 +1239,11 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) { func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL, method string) { go func() { - subjectPage := NewServerTemplatePage("password_change_subject", siteURL) + subjectPage := NewServerTemplatePage("password_change_subject") + subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName - bodyPage := NewServerTemplatePage("password_change_body", siteURL) + bodyPage := NewServerTemplatePage("password_change_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamURL"] = teamURL bodyPage.Props["Method"] = method @@ -1250,9 +1258,11 @@ func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL, func fireAndForgetEmailChangeEmail(email, teamDisplayName, teamURL, siteURL string) { go func() { - subjectPage := NewServerTemplatePage("email_change_subject", siteURL) + subjectPage := NewServerTemplatePage("email_change_subject") + subjectPage.Props["SiteURL"] = siteURL subjectPage.Props["TeamDisplayName"] = teamDisplayName - bodyPage := NewServerTemplatePage("email_change_body", siteURL) + bodyPage := NewServerTemplatePage("email_change_body") + bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamURL"] = teamURL diff --git a/config/config.json b/config/config.json index cd7e221e71..b97f3f310a 100644 --- a/config/config.json +++ b/config/config.json @@ -86,16 +86,14 @@ "ShowSkypeId": true, "ShowFullName": true }, + "ClientSettings": { + "SegmentDeveloperKey": "", + "GoogleDeveloperKey": "" + }, "TeamSettings": { "MaxUsersPerTeam": 150, "AllowPublicLink": true, "AllowValetDefault": false, - "TermsLink": "/static/help/configure_links.html", - "PrivacyLink": "/static/help/configure_links.html", - "AboutLink": "/static/help/configure_links.html", - "HelpLink": "/static/help/configure_links.html", - "ReportProblemLink": "/static/help/configure_links.html", - "TourLink": "/static/help/configure_links.html", "DefaultThemeColor": "#2389D7", "DisableTeamCreation": false, "RestrictCreationToDomains": "" diff --git a/model/client.go b/model/client.go index 5aac09289c..204d08e696 100644 --- a/model/client.go +++ b/model/client.go @@ -347,6 +347,15 @@ func (c *Client) GetLogs() (*Result, *AppError) { } } +func (c *Client) GetClientProperties() (*Result, *AppError) { + if r, err := c.DoGet("/admin/client_props", "", ""); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), MapFromJson(r.Body)}, nil + } +} + func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) { if r, err := c.DoPost("/channels/create", channel.ToJson()); err != nil { return nil, err diff --git a/utils/config.go b/utils/config.go index a1d282c29c..eb78cd08aa 100644 --- a/utils/config.go +++ b/utils/config.go @@ -4,10 +4,13 @@ package utils import ( - l4g "code.google.com/p/log4go" "encoding/json" + "fmt" "os" "path/filepath" + "strconv" + + l4g "code.google.com/p/log4go" ) const ( @@ -109,15 +112,15 @@ type PrivacySettings struct { ShowFullName bool } +type ClientSettings struct { + SegmentDeveloperKey string + GoogleDeveloperKey string +} + type TeamSettings struct { MaxUsersPerTeam int AllowPublicLink bool AllowValetDefault bool - TermsLink string - PrivacyLink string - AboutLink string - HelpLink string - ReportProblemLink string TourLink string DefaultThemeColor string DisableTeamCreation bool @@ -133,6 +136,7 @@ type Config struct { EmailSettings EmailSettings RateLimitSettings RateLimitSettings PrivacySettings PrivacySettings + ClientSettings ClientSettings TeamSettings TeamSettings SSOSettings map[string]SSOSetting } @@ -147,6 +151,8 @@ func (o *Config) ToJson() string { } var Cfg *Config = &Config{} +var CfgLastModified int64 = 0 +var ClientProperties map[string]string = map[string]string{} var SanitizeOptions map[string]bool = map[string]bool{} func FindConfigFile(fileName string) string { @@ -242,22 +248,46 @@ func LoadConfig(fileName string) { panic("Error decoding config file=" + fileName + ", err=" + err.Error()) } + if info, err := file.Stat(); err != nil { + panic("Error getting config info file=" + fileName + ", err=" + err.Error()) + } else { + CfgLastModified = info.ModTime().Unix() + } + configureLog(&config.LogSettings) Cfg = &config - SanitizeOptions = getSanitizeOptions() + SanitizeOptions = getSanitizeOptions(Cfg) + ClientProperties = getClientProperties(Cfg) } -func getSanitizeOptions() map[string]bool { +func getSanitizeOptions(c *Config) map[string]bool { options := map[string]bool{} - options["fullname"] = Cfg.PrivacySettings.ShowFullName - options["email"] = Cfg.PrivacySettings.ShowEmailAddress - options["skypeid"] = Cfg.PrivacySettings.ShowSkypeId - options["phonenumber"] = Cfg.PrivacySettings.ShowPhoneNumber + options["fullname"] = c.PrivacySettings.ShowFullName + options["email"] = c.PrivacySettings.ShowEmailAddress + options["skypeid"] = c.PrivacySettings.ShowSkypeId + options["phonenumber"] = c.PrivacySettings.ShowPhoneNumber return options } +func getClientProperties(c *Config) map[string]string { + props := make(map[string]string) + + props["Version"] = c.ServiceSettings.Version + props["SiteName"] = c.ServiceSettings.SiteName + props["ByPassEmail"] = strconv.FormatBool(c.EmailSettings.ByPassEmail) + props["ShowEmailAddress"] = strconv.FormatBool(c.PrivacySettings.ShowEmailAddress) + props["AllowPublicLink"] = strconv.FormatBool(c.TeamSettings.AllowPublicLink) + props["SegmentDeveloperKey"] = c.ClientSettings.SegmentDeveloperKey + props["GoogleDeveloperKey"] = c.ClientSettings.GoogleDeveloperKey + props["AnalyticsUrl"] = c.ServiceSettings.AnalyticsUrl + props["ProfileHeight"] = fmt.Sprintf("%v", c.ImageSettings.ProfileHeight) + props["ProfileWidth"] = fmt.Sprintf("%v", c.ImageSettings.ProfileWidth) + + return props +} + func IsS3Configured() bool { if Cfg.AWSSettings.S3AccessKeyId == "" || Cfg.AWSSettings.S3SecretAccessKey == "" || Cfg.AWSSettings.S3Region == "" || Cfg.AWSSettings.S3Bucket == "" { return false diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx index 95948c8dd7..92123956fd 100644 --- a/web/react/components/email_verify.jsx +++ b/web/react/components/email_verify.jsx @@ -1,8 +1,6 @@ // Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. -import {config} from '../utils/config.js'; - export default class EmailVerify extends React.Component { constructor(props) { super(props); @@ -19,10 +17,10 @@ export default class EmailVerify extends React.Component { var body = ''; var resend = ''; if (this.props.isVerified === 'true') { - title = config.SiteName + ' Email Verified'; + title = global.window.config.SiteName + ' Email Verified'; body =

Your email has been verified! Click Please verify your email address. Check your inbox for an email.

; resend = (