Adding terms_accepted and receive_emails_accepted params to request trial (#14937)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3e9ec51890
Коммит
a4fc0fcfb7
@@ -153,22 +153,28 @@ func requestTrialLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if *c.App.Config().ExperimentalSettings.RestrictSystemAdmin {
|
||||
c.Err = model.NewAppError("removeLicense", "api.restricted_system_admin", nil, "", http.StatusForbidden)
|
||||
c.Err = model.NewAppError("requestTrialLicense", "api.restricted_system_admin", nil, "", http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
var usersNumber struct {
|
||||
Users int `json:"users"`
|
||||
var trialRequest struct {
|
||||
Users int `json:"users"`
|
||||
TermsAccepted bool `json:"terms_accepted"`
|
||||
ReceiveEmailsAccepted bool `json:"receive_emails_accepted"`
|
||||
}
|
||||
|
||||
b, readErr := ioutil.ReadAll(r.Body)
|
||||
if readErr != nil {
|
||||
c.Err = model.NewAppError("removeLicense", "api.license.request-trial.bad-request", nil, "", http.StatusBadRequest)
|
||||
c.Err = model.NewAppError("requestTrialLicense", "api.license.request-trial.bad-request", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
json.Unmarshal(b, &usersNumber)
|
||||
if usersNumber.Users == 0 {
|
||||
c.Err = model.NewAppError("removeLicense", "api.license.request-trial.bad-request", nil, "", http.StatusBadRequest)
|
||||
json.Unmarshal(b, &trialRequest)
|
||||
if !trialRequest.TermsAccepted {
|
||||
c.Err = model.NewAppError("requestTrialLicense", "api.license.request-trial.bad-request.terms-not-accepted", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
if trialRequest.Users == 0 {
|
||||
c.Err = model.NewAppError("requestTrialLicense", "api.license.request-trial.bad-request", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -179,12 +185,14 @@ func requestTrialLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
trialLicenseRequest := &model.TrialLicenseRequest{
|
||||
ServerID: c.App.DiagnosticId(),
|
||||
Name: currentUser.GetDisplayName(model.SHOW_FULLNAME),
|
||||
Email: currentUser.Email,
|
||||
SiteName: *c.App.Config().TeamSettings.SiteName,
|
||||
SiteURL: *c.App.Config().ServiceSettings.SiteURL,
|
||||
Users: usersNumber.Users,
|
||||
ServerID: c.App.DiagnosticId(),
|
||||
Name: currentUser.GetDisplayName(model.SHOW_FULLNAME),
|
||||
Email: currentUser.Email,
|
||||
SiteName: *c.App.Config().TeamSettings.SiteName,
|
||||
SiteURL: *c.App.Config().ServiceSettings.SiteURL,
|
||||
Users: trialRequest.Users,
|
||||
TermsAccepted: trialRequest.TermsAccepted,
|
||||
ReceiveEmailsAccepted: trialRequest.ReceiveEmailsAccepted,
|
||||
}
|
||||
|
||||
if trialLicenseRequest.SiteURL == "" {
|
||||
|
||||
@@ -1500,6 +1500,10 @@
|
||||
"id": "api.license.request-trial.bad-request",
|
||||
"translation": "The number of users requested is not correct."
|
||||
},
|
||||
{
|
||||
"id": "api.license.request-trial.bad-request.terms-not-accepted",
|
||||
"translation": "You must accept the Mattermost Software Evaluation Agreement and Privacy Policy to request a license."
|
||||
},
|
||||
{
|
||||
"id": "api.license.request_trial_license.app_error",
|
||||
"translation": "Unable to get a trial license, please try again or contact with support@mattermost.com."
|
||||
|
||||
@@ -41,12 +41,14 @@ type Customer struct {
|
||||
}
|
||||
|
||||
type TrialLicenseRequest struct {
|
||||
ServerID string `json:"server_id"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
SiteURL string `json:"site_url"`
|
||||
SiteName string `json:"site_name"`
|
||||
Users int `json:"users"`
|
||||
ServerID string `json:"server_id"`
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
SiteURL string `json:"site_url"`
|
||||
SiteName string `json:"site_name"`
|
||||
Users int `json:"users"`
|
||||
TermsAccepted bool `json:"terms_accepted"`
|
||||
ReceiveEmailsAccepted bool `json:"receive_emails_accepted"`
|
||||
}
|
||||
|
||||
func (tlr *TrialLicenseRequest) ToJson() string {
|
||||
|
||||
Ссылка в новой задаче
Block a user