Browse Source

Finish new reset password, etc.

pull/357/head
Unknwon 11 years ago
parent
commit
7af7584d25
  1. 1
      .gitignore
  2. 14
      conf/locale/locale_en-US.ini
  3. 14
      conf/locale/locale_zh-CN.ini
  4. 4
      modules/middleware/auth.go
  5. 1
      public/ng/css/ui.css
  6. 58
      public/ng/less/gogs/repository.less
  7. 1
      public/ng/less/ui/form.less
  8. 5
      routers/home.go
  9. 241
      routers/user/auth.go
  10. 5
      templates/.brackets.json
  11. 3
      templates/home.tmpl
  12. 41
      templates/user/activate.tmpl
  13. 42
      templates/user/forgot_passwd.tmpl
  14. 35
      templates/user/reset_passwd.tmpl
  15. 22
      templates/user/signin.tmpl
  16. 32
      templates/user/signup.tmpl

1
.gitignore vendored

@ -38,3 +38,4 @@ __pycache__
*.pem *.pem
output* output*
config.codekit config.codekit
.brackets.json

14
conf/locale/locale_en-US.ini

@ -52,9 +52,23 @@ create_new_account = Create New Account
register_hepler_msg = Already have an account? Sign in now! register_hepler_msg = Already have an account? Sign in now!
social_register_hepler_msg = Already have an account? Bind now! social_register_hepler_msg = Already have an account? Bind now!
disable_register_prompt = Sorry, registration has been disabled. Please contact the site administrator. disable_register_prompt = Sorry, registration has been disabled. Please contact the site administrator.
disable_register_mail = Sorry, Register Mail Confirmation has been disabled.
remember_me = Remember Me remember_me = Remember Me
forgot_password= Fotgot Password
forget_password = Fotget password? forget_password = Fotget password?
sign_up_now = Need an account? Sign up now. sign_up_now = Need an account? Sign up now.
confirmation_mail_sent_prompt = A new confirmation e-mail has been sent to <b>%s</b>, please check your inbox within the next %d hours to complete your registration.
sign_in_email = Sign in to your e-mail
active_your_account = Activate Your Account
resent_limit_prompt = Sorry, you are sending an activation e-mail too frequently. Please wait 3 minutes.
has_unconfirmed_mail = Hi %s, you have an unconfirmed email address(<b>%s</b>). If you haven't received a confirmation e-mail or need to resend a new one, please click on the button below.
resend_mail = Click here to resend your activation e-mail
email_not_associate = This e-mail address does not associate to any account.
send_reset_mail = Click here to (re)send your passowrd reset e-mail
reset_password = Reset Your Password
invalid_code = Sorry, your confirmation code has exipired or not valid.
reset_password_helper = Click here to reset your password
password_too_short = Password length cannot be less then 6.
[form] [form]
UserName = Username UserName = Username

14
conf/locale/locale_zh-CN.ini

@ -52,9 +52,23 @@ create_new_account = 创建帐户
register_hepler_msg = 已经注册?立即登录! register_hepler_msg = 已经注册?立即登录!
social_register_hepler_msg = 已经注册?立即绑定! social_register_hepler_msg = 已经注册?立即绑定!
disable_register_prompt = 对不起,注册功能已被关闭。请联系网站管理员。 disable_register_prompt = 对不起,注册功能已被关闭。请联系网站管理员。
disable_register_mail = 对不起,注册邮箱确认功能已被关闭。
remember_me = 记住登录 remember_me = 记住登录
forgot_password = 忘记密码
forget_password = 忘记密码? forget_password = 忘记密码?
sign_up_now = 还没帐户?马上注册。 sign_up_now = 还没帐户?马上注册。
confirmation_mail_sent_prompt = 一封新的确认邮件已经被发送至 <b>%s</b>,请检查您的收件箱并在 %d 小时内完成确认注册操作。
sign_in_email = 登录到您的邮箱
active_your_account = 激活您的帐户
resent_limit_prompt = 对不起,您请求发送激活邮件过于频繁,请等待 3 分钟后再试!
has_unconfirmed_mail = %s 您好,系统检测到您有一封发送至 <b>%s</b> 但未被确认的邮件。如果您未收到激活邮件,或需要重新发送,请单击下方的按钮。
resend_mail = 单击此处重新发送确认邮件
email_not_associate = 您输入的邮箱地址未被关联到任何帐号!
send_reset_mail = 单击此处(重新)发送您的密码重置邮件
reset_password = 重置密码
invalid_code = 对不起,您的确认代码已过期或已失效。
reset_password_helper = 单击此处重置密码
password_too_short = 密码长度不能少于 6 位!
[form] [form]
UserName = 用户名 UserName = 用户名

4
modules/middleware/auth.go

@ -5,6 +5,7 @@
package middleware package middleware
import ( import (
"fmt"
"net/url" "net/url"
"strings" "strings"
@ -43,6 +44,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
} }
if options.SignInRequire { if options.SignInRequire {
fmt.Println(ctx.User.IsActive, setting.Service.RegisterEmailConfirm)
if !ctx.IsSigned { if !ctx.IsSigned {
// Ignore watch repository operation. // Ignore watch repository operation.
if strings.HasSuffix(ctx.Req.RequestURI, "watch") { if strings.HasSuffix(ctx.Req.RequestURI, "watch") {
@ -52,7 +54,7 @@ func Toggle(options *ToggleOptions) macaron.Handler {
ctx.Redirect("/user/login") ctx.Redirect("/user/login")
return return
} else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { } else if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
// ctx.Data["Title"] = "Activate Your Account" ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
ctx.HTML(200, "user/activate") ctx.HTML(200, "user/activate")
return return
} }

1
public/ng/css/ui.css

@ -435,6 +435,7 @@ dt {
} }
.btn-link { .btn-link {
overflow: visible; overflow: visible;
color: white;
padding: .6em 1.2em; padding: .6em 1.2em;
} }
.btn-radius { .btn-radius {

58
public/ng/less/gogs/repository.less

@ -1,22 +1,25 @@
@import "../ui/var"; @import "../ui/var";
@repoHeaderBorderColor: #D6D6D6; @repoHeaderBorderColor: #D6D6D6;
@repoHeaderBgColor: #FFF; @repoHeaderBgColor: #FFF;
@repoHeaderNameColor: #888; @repoHeaderNameColor: #888;
/* repository main */ /* repository main */
#repo-wrapper { #repo-wrapper {
padding-bottom: 100px; padding-bottom: 100px;
} }
#repo-header { #repo-header {
height: 69px; height: 69px;
border-bottom: 1px solid @repoHeaderBorderColor; border-bottom: 1px solid@repoHeaderBorderColor;
background-color: @repoHeaderBgColor;
background-color: @repoHeaderBgColor;
} }
#repo-header-name { #repo-header-name {
line-height: 66px; line-height: 66px;
color: @repoHeaderNameColor; color: @repoHeaderNameColor;
font-size: 1.6em;
font-size: 1.6em;
font-weight: normal; font-weight: normal;
margin-bottom: 0; margin-bottom: 0;
i { i {
@ -27,7 +30,6 @@
margin: 0 4px; margin: 0 4px;
} }
} }
#repo-header-meta { #repo-header-meta {
line-height: 66px; line-height: 66px;
li { li {
@ -44,36 +46,37 @@
i { i {
margin-right: 6px; margin-right: 6px;
} }
line-height: 16px; line-height:16px;
.num { .num {
margin-left: 6px; margin-left: 6px;
} }
} }
} }
#repo-header-download-btn { #repo-header-download-btn {
> .btn > i { > .btn > i {
margin-right: 0 !important; margin-right: 0 !important;
} }
&:hover { &:hover {
&:after, &:after, .btn {
.btn {
background-color: @btnHoverBlackColor; background-color: @btnHoverBlackColor;
color: #FFF;
color: #FFF;
} }
} }
&:after { &:after {
background-color: @btnBlackColor; background-color: @btnBlackColor;
padding: 9px 16px 8px 0;
padding: 9px 16px 8px 0;
margin-left: -8px !important; margin-left: -8px !important;
color: #FFF; color: #FFF;
border-top: 1px solid @btnBlackColor; border-top: 1px solid@btnBlackColor;
border-bottom: 1px solid @btnBlackColor;
border-top-right-radius: .25em; border-bottom: 1px solid@btnBlackColor;
border-top-right-radius: .25em;
border-bottom-right-radius: .25em; border-bottom-right-radius: .25em;
} }
} }
#repo-header-download-drop { #repo-header-download-drop {
line-height: 24px; line-height: 24px;
width: 440px; width: 440px;
@ -85,21 +88,17 @@
margin-right: 6px; margin-right: 6px;
} }
} }
#repo-content { #repo-content {
padding: 18px 0; padding: 18px 0;
} }
#repo-clone-url { #repo-clone-url {
border-right: none; border-right: none;
width: 196px; width: 196px;
border-left: none; border-left: none;
} }
#repo-clone-help { #repo-clone-help {
line-height: 48px; line-height: 48px;
} }
#repo-clone-zip { #repo-clone-zip {
line-height: 48px; line-height: 48px;
a { a {
@ -112,11 +111,9 @@
margin: 0 6px; margin: 0 6px;
} }
} }
#repo-desc { #repo-desc {
font-size: 1.2em; font-size: 1.2em;
} }
#repo-sidebar-nav { #repo-sidebar-nav {
.label { .label {
font-size: 12px; font-size: 12px;
@ -127,7 +124,6 @@
margin-right: 6px; margin-right: 6px;
} }
} }
#repo-file-nav { #repo-file-nav {
padding: .6em 0 1em 0; padding: .6em 0 1em 0;
> li > a { > li > a {
@ -143,7 +139,6 @@
} }
} }
} }
#repo-branch-switch { #repo-branch-switch {
> a { > a {
.btn { .btn {
@ -155,6 +150,7 @@
right: 30px; right: 30px;
margin-left: 0; margin-left: 0;
color: @baseFontColor; color: @baseFontColor;
} }
} }
> .drop-down { > .drop-down {
@ -162,14 +158,12 @@
left: 0; left: 0;
} }
} }
#repo-branch-filter-ipt { #repo-branch-filter-ipt {
width: 100%; width: 100%;
border-left: none; border-left: none;
border-right: none; border-right: none;
box-sizing: border-box; box-sizing: border-box;
} }
#repo-branch-tag { #repo-branch-tag {
.tab-nav { .tab-nav {
border-bottom: 1px solid #EAEAEA; border-bottom: 1px solid #EAEAEA;
@ -182,7 +176,6 @@
} }
} }
} }
#repo-branch-list, #repo-branch-list,
#repo-tag-list { #repo-tag-list {
li { li {
@ -197,11 +190,9 @@
} }
} }
} }
#repo-tag-list { #repo-tag-list {
display: none; display: none;
} }
#repo-bread { #repo-bread {
.bread { .bread {
padding-right: 0; padding-right: 0;
@ -209,16 +200,13 @@
font-weight: bold; font-weight: bold;
} }
} }
#repo-main { #repo-main {
padding-right: 40px; padding-right: 40px;
box-sizing: border-box; box-sizing: border-box;
} }
#repo-files-table { #repo-files-table {
margin-bottom: 20px; margin-bottom: 20px;
th, th, td {
td {
text-align: left; text-align: left;
line-height: 32px; line-height: 32px;
} }
@ -280,11 +268,9 @@
} }
} }
} }
#repo-readme { #repo-readme {
margin-bottom: 80px; margin-bottom: 80px;
} }
#repo-bare-start { #repo-bare-start {
margin-bottom: 100px; margin-bottom: 100px;
.panel-content { .panel-content {
@ -297,7 +283,6 @@
background: #f8f8f8; background: #f8f8f8;
} }
} }
.repo-bare { .repo-bare {
#repo-bare-start { #repo-bare-start {
h2 { h2 {
@ -322,7 +307,6 @@
width: 520px; width: 520px;
} }
} }
/* repository create */ /* repository create */
#repo-migrate-form, #repo-migrate-form,
@ -352,11 +336,9 @@
box-shadow: 0px 0px 6px #CCC; box-shadow: 0px 0px 6px #CCC;
} }
} }
#repo-create-cancel { #repo-create-cancel {
margin-left: 4em; margin-left: 4em;
} }
#repo-create-owner-list { #repo-create-owner-list {
top: 30px; top: 30px;
left: 0; left: 0;

1
public/ng/less/ui/form.less

@ -81,6 +81,7 @@
} }
.btn-link { .btn-link {
overflow: visible; overflow: visible;
color: white;
padding: .6em 1.2em; padding: .6em 1.2em;
} }
.btn-radius { .btn-radius {

5
routers/home.go

@ -17,7 +17,12 @@ const (
func Home(ctx *middleware.Context) { func Home(ctx *middleware.Context) {
if ctx.IsSigned { if ctx.IsSigned {
if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm {
ctx.Data["Title"] = ctx.Tr("auth.active_your_account")
ctx.HTML(200, user.ACTIVATE)
} else {
user.Dashboard(ctx) user.Dashboard(ctx)
}
return return
} }

241
routers/user/auth.go

@ -106,10 +106,9 @@ func SignInPost(ctx *middleware.Context, form auth.SignInForm) {
if err != nil { if err != nil {
if err == models.ErrUserNotExist { if err == models.ErrUserNotExist {
ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), SIGNIN, &form) ctx.RenderWithErr(ctx.Tr("form.username_password_incorrect"), SIGNIN, &form)
return } else {
}
ctx.Handle(500, "UserSignIn", err) ctx.Handle(500, "UserSignIn", err)
}
return return
} }
@ -294,55 +293,59 @@ func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.Registe
} }
func Activate(ctx *middleware.Context) { func Activate(ctx *middleware.Context) {
// code := ctx.Query("code") code := ctx.Query("code")
// if len(code) == 0 { if len(code) == 0 {
// ctx.Data["IsActivatePage"] = true ctx.Data["IsActivatePage"] = true
// if ctx.User.IsActive { if ctx.User.IsActive {
// ctx.Handle(404, "user.Activate", nil) ctx.Error(404)
// return return
// } }
// // Resend confirmation e-mail. // Resend confirmation e-mail.
// if setting.Service.RegisterEmailConfirm { if setting.Service.RegisterEmailConfirm {
// if ctx.Cache.IsExist("MailResendLimit_" + ctx.User.LowerName) { if ctx.Cache.IsExist("MailResendLimit_" + ctx.User.LowerName) {
// ctx.Data["ResendLimited"] = true ctx.Data["ResendLimited"] = true
// } else { } else {
// ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
// mailer.SendActiveMail(ctx.Render, ctx.User) mailer.SendActiveMail(ctx.Render, ctx.User)
// if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil { if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
// log.Error("Set cache(MailResendLimit) fail: %v", err) log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
// } }
// } }
// } else { } else {
// ctx.Data["ServiceNotEnabled"] = true ctx.Data["ServiceNotEnabled"] = true
// } }
// ctx.HTML(200, ACTIVATE) ctx.HTML(200, ACTIVATE)
// return return
// } }
// // Verify code. // Verify code.
// if user := models.VerifyUserActiveCode(code); user != nil { if user := models.VerifyUserActiveCode(code); user != nil {
// user.IsActive = true user.IsActive = true
// user.Rands = models.GetUserSalt() user.Rands = models.GetUserSalt()
// if err := models.UpdateUser(user); err != nil { if err := models.UpdateUser(user); err != nil {
// ctx.Handle(404, "user.Activate", err) if err == models.ErrUserNotExist {
// return ctx.Error(404)
// } } else {
ctx.Handle(500, "UpdateUser", err)
// log.Trace("%s User activated: %s", ctx.Req.RequestURI, user.Name) }
return
// ctx.Session.Set("userId", user.Id) }
// ctx.Session.Set("userName", user.Name)
// ctx.Redirect("/") log.Trace("User activated: %s", user.Name)
// return
// } ctx.Session.Set("uid", user.Id)
ctx.Session.Set("uname", user.Name)
// ctx.Data["IsActivateFailed"] = true ctx.Redirect("/")
// ctx.HTML(200, ACTIVATE) return
}
ctx.Data["IsActivateFailed"] = true
ctx.HTML(200, ACTIVATE)
} }
func ForgotPasswd(ctx *middleware.Context) { func ForgotPasswd(ctx *middleware.Context) {
ctx.Data["Title"] = "Forgot Password" ctx.Data["Title"] = ctx.Tr("auth.forgot_password")
if setting.MailService == nil { if setting.MailService == nil {
ctx.Data["IsResetDisable"] = true ctx.Data["IsResetDisable"] = true
@ -355,44 +358,45 @@ func ForgotPasswd(ctx *middleware.Context) {
} }
func ForgotPasswdPost(ctx *middleware.Context) { func ForgotPasswdPost(ctx *middleware.Context) {
// ctx.Data["Title"] = "Forgot Password" ctx.Data["Title"] = ctx.Tr("auth.forgot_password")
// if setting.MailService == nil { if setting.MailService == nil {
// ctx.Handle(403, "user.ForgotPasswdPost", nil) ctx.Handle(403, "user.ForgotPasswdPost", nil)
// return return
// } }
// ctx.Data["IsResetRequest"] = true ctx.Data["IsResetRequest"] = true
// email := ctx.Query("email") email := ctx.Query("email")
// u, err := models.GetUserByEmail(email) u, err := models.GetUserByEmail(email)
// if err != nil { if err != nil {
// if err == models.ErrUserNotExist { if err == models.ErrUserNotExist {
// ctx.RenderWithErr("This e-mail address does not associate to any account.", "user/forgot_passwd", nil) ctx.Data["Err_Email"] = true
// } else { ctx.RenderWithErr(ctx.Tr("auth.email_not_associate"), FORGOT_PASSWORD, nil)
// ctx.Handle(500, "user.ResetPasswd(check existence)", err) } else {
// } ctx.Handle(500, "user.ResetPasswd(check existence)", err)
// return }
// } return
}
// if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) {
// ctx.Data["ResendLimited"] = true if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) {
// ctx.HTML(200, FORGOT_PASSWORD) ctx.Data["ResendLimited"] = true
// return ctx.HTML(200, FORGOT_PASSWORD)
// } return
}
// mailer.SendResetPasswdMail(ctx.Render, u)
// if err = ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil { mailer.SendResetPasswdMail(ctx.Render, u)
// log.Error("Set cache(MailResendLimit) fail: %v", err) if err = ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil {
// } log.Error(4, "Set cache(MailResendLimit) fail: %v", err)
}
// ctx.Data["Email"] = email
// ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 ctx.Data["Email"] = email
// ctx.Data["IsResetSent"] = true ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60
// ctx.HTML(200, FORGOT_PASSWORD) ctx.Data["IsResetSent"] = true
ctx.HTML(200, FORGOT_PASSWORD)
} }
func ResetPasswd(ctx *middleware.Context) { func ResetPasswd(ctx *middleware.Context) {
ctx.Data["Title"] = "Reset Password" ctx.Data["Title"] = ctx.Tr("auth.reset_password")
code := ctx.Query("code") code := ctx.Query("code")
if len(code) == 0 { if len(code) == 0 {
@ -405,38 +409,39 @@ func ResetPasswd(ctx *middleware.Context) {
} }
func ResetPasswdPost(ctx *middleware.Context) { func ResetPasswdPost(ctx *middleware.Context) {
// ctx.Data["Title"] = "Reset Password" ctx.Data["Title"] = ctx.Tr("auth.reset_password")
// code := ctx.Query("code") code := ctx.Query("code")
// if len(code) == 0 { if len(code) == 0 {
// ctx.Error(404) ctx.Error(404)
// return return
// } }
// ctx.Data["Code"] = code ctx.Data["Code"] = code
// if u := models.VerifyUserActiveCode(code); u != nil { if u := models.VerifyUserActiveCode(code); u != nil {
// // Validate password length. // Validate password length.
// passwd := ctx.Query("passwd") passwd := ctx.Query("password")
// if len(passwd) < 6 || len(passwd) > 30 { if len(passwd) < 6 {
// ctx.Data["IsResetForm"] = true ctx.Data["IsResetForm"] = true
// ctx.RenderWithErr("Password length should be in 6 and 30.", "user/reset_passwd", nil) ctx.Data["Err_Password"] = true
// return ctx.RenderWithErr(ctx.Tr("auth.password_too_short"), RESET_PASSWORD, nil)
// } return
}
// u.Passwd = passwd
// u.Rands = models.GetUserSalt() u.Passwd = passwd
// u.Salt = models.GetUserSalt() u.Rands = models.GetUserSalt()
// u.EncodePasswd() u.Salt = models.GetUserSalt()
// if err := models.UpdateUser(u); err != nil { u.EncodePasswd()
// ctx.Handle(500, "user.ResetPasswd(UpdateUser)", err) if err := models.UpdateUser(u); err != nil {
// return ctx.Handle(500, "UpdateUser", err)
// } return
}
// log.Trace("%s User password reset: %s", ctx.Req.RequestURI, u.Name)
// ctx.Redirect("/user/login") log.Trace("User password reset: %s", u.Name)
// return ctx.Redirect("/user/login")
// } return
}
// ctx.Data["IsResetFailed"] = true
// ctx.HTML(200, RESET_PASSWORD) ctx.Data["IsResetFailed"] = true
ctx.HTML(200, RESET_PASSWORD)
} }

5
templates/.brackets.json

@ -1,5 +0,0 @@
{
"language.fileExtensions": {
"tmpl": "html"
}
}

3
templates/home.tmpl

@ -1,4 +1,5 @@
{{template "ng/base/head" .}} {{template "ng/base/header" .}} {{template "ng/base/head" .}}
{{template "ng/base/header" .}}
<div id="promo-wrapper"> <div id="promo-wrapper">
<div class="container clear"> <div class="container clear">
<div id="promo-logo" class="left"> <div id="promo-logo" class="left">

41
templates/user/activate.tmpl

@ -1,36 +1,39 @@
{{template "base/head" .}} {{template "ng/base/head" .}}
{{template "base/navbar" .}} {{template "ng/base/header" .}}
<div id="body" class="container"> <div id="sign-wrapper">
<form action="/user/activate" method="post" class="form-horizontal card" id="login-card"> <form class="form-align form panel sign-panel sign-form container panel-radius" id="sign-up-form" action="/user/activate" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<h3>Activate Your Account</h3> <div class="panel-header">
<h2>{{.i18n.Tr "auth.active_your_account"}}</h2>
</div>
<div class="panel-content">
{{if .IsActivatePage}} {{if .IsActivatePage}}
{{if .ServiceNotEnabled}} {{if .ServiceNotEnabled}}
<p>Sorry, Register Mail Confirmation has been disabled.</p> <p>{{.i18n.Tr "auth.disable_register_mail"}}</p>
{{else if .ResendLimited}} {{else if .ResendLimited}}
<p>Sorry, you are sending an activation e-mail too frequently. Please wait 3 minutes.</p> <p>{{.i18n.Tr "auth.resent_limit_prompt"}}</p>
{{else}} {{else}}
<p>A new confirmation e-mail has been sent to <b>{{.SignedUser.Email}}</b>, please check your inbox within the next {{.Hours}} hours to complete your registration.</p> <p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" .SignedUser.Email .Hours | Str2html}}</p>
<hr/> <hr/>
<a href="http://{{Mail2Domain .SignedUser.Email}}" class="btn btn-lg btn-success">Sign in to your e-mail</a> <label></label>
<a class="btn btn-green btn-large btn-link btn-radius" href="http://{{Mail2Domain .SignedUser.Email}}">{{.i18n.Tr "auth.sign_in_email"}}</a>
{{end}} {{end}}
{{else}} {{else}}
{{if .IsSendRegisterMail}} {{if .IsSendRegisterMail}}
<p>A confirmation e-mail has been sent to <b>{{.Email}}</b>, please check your inbox within the next {{.Hours}} hours to complete your registration.</p> <p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" .Email .Hours | Str2html}}</p>
<hr/> <hr/>
<a href="http://{{Mail2Domain .Email}}" class="btn btn-lg btn-success">Sign in to your e-mail</a> <label></label>
<a class="btn btn-green btn-large btn-link btn-radius" href="http://{{Mail2Domain .Email}}">{{.i18n.Tr "auth.sign_in_email"}}</a>
{{else if .IsActivateFailed}} {{else if .IsActivateFailed}}
<p>Sorry, your confirmation code has exipired or not valid.</p> <p>{{.i18n.Tr "auth.invalid_code"}}</p>
{{else}} {{else}}
<p>Hi, {{.SignedUser.Name}}, you have an unconfirmed email address(<b>{{.SignedUser.Email}}</b>). If you haven't received a confirmation e-mail or need to resend a new one, please click on the button below.</p> <p>{{.i18n.Tr "auth.has_unconfirmed_mail" .SignedUser.Name .SignedUser.Email | Str2html}}</p>
<hr/> <hr/>
<div class="form-group"> <label></label>
<div class="col-md-offset-4 col-md-6"> <button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "auth.resend_mail"}}</button>
<button type="submit" class="btn btn-lg btn-primary">Click here to resend your activation e-mail</button>
</div>
</div>
{{end}} {{end}}
{{end}} {{end}}
</div>
</form> </form>
</div> </div>
{{template "base/footer" .}} {{template "ng/base/footer" .}}

42
templates/user/forgot_passwd.tmpl

@ -1,32 +1,32 @@
{{template "base/head" .}} {{template "ng/base/head" .}}
{{template "base/navbar" .}} {{template "ng/base/header" .}}
<div id="body" class="container"> <div id="sign-wrapper">
<form action="/user/forget_password" method="post" class="form-horizontal card" id="login-card"> <form class="form-align form panel sign-panel sign-form container panel-radius" id="sign-up-form" action="/user/forget_password" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<h3>Reset Your Password</h3> <div class="panel-header">
{{template "base/alert" .}} <h2>{{.i18n.Tr "auth.forgot_password"}}</h2>
</div>
<div class="panel-content">
{{template "ng/base/alert" .}}
{{if .IsResetSent}} {{if .IsResetSent}}
<p>A confirmation e-mail has been sent to <b>{{.Email}}</b>, please check your inbox within {{.Hours}} hours.</p> <p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" .Email .Hours | Str2html}}</p>
<hr/> <hr/>
<a href="http://{{Mail2Domain .Email}}" class="btn btn-lg btn-success">Sign in to your e-mail</a> <label></label>
<a class="btn btn-green btn-large btn-link btn-radius" href="http://{{Mail2Domain .Email}}">{{.i18n.Tr "auth.sign_in_email"}}</a>
{{else if .IsResetRequest}} {{else if .IsResetRequest}}
<div class="form-group {{if .Err_Email}}has-error has-feedback{{end}}"> <div class="field">
<label class="col-md-3 control-label">Email: </label> <label class="req" for="email">{{.i18n.Tr "email"}}</label>
<div class="col-md-7"> <input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.email}}"required/>
<input name="email" class="form-control" placeholder="Type your e-mail address" required="required">
</div>
</div> </div>
<hr/> <hr/>
<div class="form-group"> <label></label>
<div class="col-md-offset-4 col-md-6"> <button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "auth.send_reset_mail"}}</button>
<button type="submit" class="btn btn-lg btn-primary">Click here to send resend confirmation e-mail</button>
</div>
</div>
{{else if .IsResetDisable}} {{else if .IsResetDisable}}
<p>Sorry, mail service is not enabled.</p> <p>{{.i18n.Tr "auth.disable_register_mail"}}</p>
{{else if .ResendLimited}} {{else if .ResendLimited}}
<p>Sorry, you are sending an e-mail too frequently, please wait another 3 minutes and try again.</p> <p>{{.i18n.Tr "auth.resent_limit_prompt"}}</p>
{{end}} {{end}}
</div>
</form> </form>
</div> </div>
{{template "base/footer" .}} {{template "ng/base/footer" .}}

35
templates/user/reset_passwd.tmpl

@ -1,26 +1,25 @@
{{template "base/head" .}} {{template "ng/base/head" .}}
{{template "base/navbar" .}} {{template "ng/base/header" .}}
<div id="body" class="container"> <div id="sign-wrapper">
<form action="/user/reset_password?code={{.Code}}" method="post" class="form-horizontal card" id="login-card"> <form class="form-align form panel sign-panel sign-form container panel-radius" id="sign-up-form" action="/user/reset_password?code={{.Code}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<h3>Reset Your Pasword</h3> <div class="panel-header">
{{template "base/alert" .}} <h2>{{.i18n.Tr "auth.reset_password"}}</h2>
{{if .IsResetForm}}
<div class="form-group">
<label class="col-md-4 control-label">Password: </label>
<div class="col-md-6">
<input name="passwd" type="password" class="form-control" placeholder="Type your password" required="required">
</div> </div>
<div class="panel-content">
{{template "ng/base/alert" .}}
{{if .IsResetForm}}
<div class="field">
<label class="req" for="password">{{.i18n.Tr "password"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" value="{{.password}}" required/>
</div> </div>
<hr/> <hr/>
<div class="form-group"> <label></label>
<div class="col-md-offset-4 col-md-6"> <button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "auth.reset_password_helper"}}</button>
<button type="submit" class="btn btn-lg btn-primary">Click here to reset your password</button>
</div>
</div>
{{else}} {{else}}
<p>Sorry, your confirmation code has expired or is not valid.</p> <p>{{.i18n.Tr "auth.invalid_code"}}</p>
{{end}} {{end}}
</div>
</form> </form>
</div> </div>
{{template "base/footer" .}} {{template "ng/base/footer" .}}

22
templates/user/signin.tmpl

@ -7,30 +7,30 @@
</div> </div>
<div class="panel-content"> <div class="panel-content">
{{template "ng/base/alert" .}} {{template "ng/base/alert" .}}
<p class="field"> <div class="field">
<label class="req" for="username">{{.i18n.Tr "home.uname_holder"}}</label> <label class="req" for="username">{{.i18n.Tr "home.uname_holder"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_UserName}}ipt-error{{end}}" id="username" name="uname" type="text" value="{{.uname}}" required/> <input class="ipt ipt-large ipt-radius {{if .Err_UserName}}ipt-error{{end}}" id="username" name="uname" type="text" value="{{.uname}}" required/>
</p> </div>
<p class="field"> <div class="field">
<label class="req" for="password">{{.i18n.Tr "password"}}</label> <label class="req" for="password">{{.i18n.Tr "password"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" required/> <input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" required/>
</p> </div>
{{if not .IsSocialLogin}} {{if not .IsSocialLogin}}
<p class="field"> <div class="field">
<span class="form-label"></span> <span class="form-label"></span>
<input class="ipt-chk" id="remember" name="remember" type="checkbox"/>&nbsp;&nbsp;&nbsp;&nbsp;<strong>{{.i18n.Tr "auth.remember_me"}}</strong> <input class="ipt-chk" id="remember" name="remember" type="checkbox"/>&nbsp;&nbsp;&nbsp;&nbsp;<strong>{{.i18n.Tr "auth.remember_me"}}</strong>
</p> </div>
{{end}} {{end}}
<p class="field"> <div class="field">
<span class="form-label"></span> <span class="form-label"></span>
<button class="btn btn-green btn-large btn-radius">{{.i18n.Tr "sign_in"}}</button>&nbsp;&nbsp;&nbsp;&nbsp; <button class="btn btn-green btn-large btn-radius">{{.i18n.Tr "sign_in"}}</button>&nbsp;&nbsp;&nbsp;&nbsp;
{{if not .IsSocialLogin}}<a href="/user/forget_password">{{.i18n.Tr "auth.forget_password"}}</a>{{end}} {{if not .IsSocialLogin}}<a href="/user/forget_password">{{.i18n.Tr "auth.forget_password"}}</a>{{end}}
</p> </div>
{{if not .IsSocialLogin}} {{if not .IsSocialLogin}}
<p class="field"> <div class="field">
<span class="form-label"></span> <label></label>
<a href="/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a> <a href="/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
</p> </div>
{{if .OauthEnabled}} {{if .OauthEnabled}}
<hr/> <hr/>
<div id="sign-social" class="text-center social-buttons"> <div id="sign-social" class="text-center social-buttons">

32
templates/user/signup.tmpl

@ -10,38 +10,38 @@
{{if .DisableRegistration}} {{if .DisableRegistration}}
<p>{{.i18n.Tr "auth.disable_register_prompt"}}</p> <p>{{.i18n.Tr "auth.disable_register_prompt"}}</p>
{{else}} {{else}}
<p class="field"> <div class="field">
<label class="req" for="username">{{.i18n.Tr "username"}}</label> <label class="req" for="username">{{.i18n.Tr "username"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_UserName}}ipt-error{{end}}" id="username" name="uname" type="text" value="{{.uname}}" required/> <input class="ipt ipt-large ipt-radius {{if .Err_UserName}}ipt-error{{end}}" id="username" name="uname" type="text" value="{{.uname}}" required/>
</p> </div>
<p class="field"> <div class="field">
<label class="req" for="email">{{.i18n.Tr "email"}}</label> <label class="req" for="email">{{.i18n.Tr "email"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.email}}"required/> <input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.email}}"required/>
</p> </div>
<p class="field"> <div class="field">
<label class="req" for="password">{{.i18n.Tr "password"}}</label> <label class="req" for="password">{{.i18n.Tr "password"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" value="{{.password}}" required/> <input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" value="{{.password}}" required/>
</p> </div>
<p class="field"> <div class="field">
<label class="req" for="re-type">{{.i18n.Tr "re_type"}}</label> <label class="req" for="re-type">{{.i18n.Tr "re_type"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="re-type" name="retype" type="password" required/> <input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="re-type" name="retype" type="password" required/>
</p> </div>
<p class="field"> <div class="field">
<label></label> <label></label>
{{.Captcha.CreateHtml}} {{.Captcha.CreateHtml}}
</p> </div>
<p class="field"> <div class="field">
<label class="req" for="captcha">{{.i18n.Tr "captcha"}}</label> <label class="req" for="captcha">{{.i18n.Tr "captcha"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Captcha}}ipt-error{{end}}" id="captcha" name="captcha" type="text" required/> <input class="ipt ipt-large ipt-radius {{if .Err_Captcha}}ipt-error{{end}}" id="captcha" name="captcha" type="text" required/>
</p> </div>
<p class="field"> <div class="field">
<span class="form-label"></span> <span class="form-label"></span>
<button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "auth.create_new_account"}}</button> <button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "auth.create_new_account"}}</button>
</p> </div>
<p class="field"> <div class="field">
<span class="form-label"></span> <span class="form-label"></span>
<a href="/user/login">{{if .IsSocialLogin}}{{.i18n.Tr "auth.social_register_hepler_msg"}}{{else}}{{.i18n.Tr "auth.register_hepler_msg"}}{{end}}</a> <a href="/user/login">{{if .IsSocialLogin}}{{.i18n.Tr "auth.social_register_hepler_msg"}}{{else}}{{.i18n.Tr "auth.register_hepler_msg"}}{{end}}</a>
</p> </div>
{{end}} {{end}}
</div> </div>
</form> </form>

Loading…
Cancel
Save