diff --git a/modules/convert/convert.go b/modules/convert/convert.go old mode 100644 new mode 100755 index ec18b1305..fa2e8f2e7 --- a/modules/convert/convert.go +++ b/modules/convert/convert.go @@ -335,6 +335,7 @@ func ToUser(user *models.User, signed, authed bool) *api.User { AvatarURL: user.AvatarLink(), FullName: markup.Sanitize(user.FullName), Created: user.CreatedUnix.AsTime(), + IsActive: user.IsActive, } // hide primary email if API caller is anonymous or user keep email private if signed && (!user.KeepEmailPrivate || authed) { diff --git a/modules/structs/user.go b/modules/structs/user.go old mode 100644 new mode 100755 index bf52cc9ed..d6e7298cc --- a/modules/structs/user.go +++ b/modules/structs/user.go @@ -26,6 +26,8 @@ type User struct { Language string `json:"language"` // Is the user an administrator IsAdmin bool `json:"is_admin"` + // Is the user active + IsActive bool `json:"is_active"` // swagger:strfmt date-time LastLogin time.Time `json:"last_login,omitempty"` // swagger:strfmt date-time diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e809a33e8..b81dc9694 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -90,7 +90,7 @@ loading = Loading… error404_index = Request forbidden by administrative rules error500_index = Internal Server Error error404 = The page you are trying to reach either does not exist or you are not authorized to view it. - +error500= Sorry, the site has encountered some problems, we are trying to fix the page, please try again later. [error] occurred = An error has occurred report_message = An error has occurred diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 9747bc7dc..5ac54f6c8 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -90,6 +90,7 @@ loading=正在加载... error404_index = 您的访问受限! error500_index = 抱歉!您指定的网页无法访问。 error404=您正尝试访问的页面 不存在您尚未被授权 查看该页面。 +error500=抱歉,站点遇到一些问题,我们正尝试修复网页,请您稍后再试。 [error] occurred=发生错误 diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 100ff009f..b3565878e 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1129,7 +1129,7 @@ func RegisterRoutes(m *macaron.Macaron) { //secure api, m.Group("/secure", func() { - m.Post("/user", binding.Bind(structs.CreateUserOption{}), secure.CreateUser) + m.Post("/user", binding.BindIgnErr(structs.CreateUserOption{}), secure.CreateUser) }, reqBasicAuth) m.Group("/api/internal", func() { diff --git a/routers/secure/user.go b/routers/secure/user.go index 1e88a7381..808761d06 100755 --- a/routers/secure/user.go +++ b/routers/secure/user.go @@ -119,6 +119,14 @@ func CreateUser(ctx *context.Context, form api.CreateUserOption) { return } + // Send confirmation email + if setting.Service.RegisterEmailConfirm{ + mailer.SendActivateAccountMail(ctx.Locale, u) + if err := ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil { + log.Error("Set cache(MailResendLimit) fail: %v", err) + } + } + log.Trace("Account created (%s): %s", ctx.User.Name, u.Name, ctx.Data["MsgID"]) // Send email notification. diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl index e4ea06d3d..ca7336f82 100644 --- a/templates/status/500.tmpl +++ b/templates/status/500.tmpl @@ -6,7 +6,7 @@

{{.i18n.Tr "error500_index"}}

-

{{.i18n.Tr "error404" | Safe}}

+

{{.i18n.Tr "error500" | Safe}}