mirror of
https://github.com/go-gitea/gitea
synced 2024-11-15 14:31:41 +01:00
#697 disable captcha and new admin create user UI
This commit is contained in:
parent
e2d6b0116e
commit
8e0a69f86a
19 changed files with 228 additions and 179 deletions
|
@ -99,6 +99,8 @@ ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
|||
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
|
||||
; Do not check minimum key size with corresponding type
|
||||
DISABLE_MINIMUM_KEY_SIZE_CHECK = false
|
||||
; Disable captcha validation for registration
|
||||
DISABLE_CAPTCHA = false
|
||||
|
||||
[webhook]
|
||||
; Hook task queue length
|
||||
|
|
|
@ -780,6 +780,7 @@ users.activated = Activated
|
|||
users.admin = Admin
|
||||
users.repos = Repos
|
||||
users.created = Created
|
||||
users.new_success = New account '%s' has been created successfully.
|
||||
users.edit = Edit
|
||||
users.auth_source = Authentication Source
|
||||
users.local = Local
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
|||
"github.com/gogits/gogs/modules/setting"
|
||||
)
|
||||
|
||||
const APP_VER = "0.6.11.0912 Beta"
|
||||
const APP_VER = "0.6.11.0913 Beta"
|
||||
|
||||
func init() {
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
|
|
@ -175,7 +175,7 @@ func CreateSource(source *LoginSource) error {
|
|||
return err
|
||||
}
|
||||
|
||||
func GetAuths() ([]*LoginSource, error) {
|
||||
func LoginSources() ([]*LoginSource, error) {
|
||||
auths := make([]*LoginSource, 0, 5)
|
||||
return auths, x.Find(&auths)
|
||||
}
|
||||
|
|
|
@ -58,12 +58,12 @@ func (f *InstallForm) Validate(ctx *macaron.Context, errs binding.Errors) bindin
|
|||
// \/ \/
|
||||
|
||||
type RegisterForm struct {
|
||||
UserName string `form:"uname" binding:"Required;AlphaDashDot;MaxSize(35)"`
|
||||
Email string `form:"email" binding:"Required;Email;MaxSize(254)"`
|
||||
Password string `form:"password" binding:"Required;MaxSize(255)"`
|
||||
Retype string `form:"retype"`
|
||||
LoginType string `form:"logintype"`
|
||||
LoginName string `form:"loginname"`
|
||||
UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
|
||||
Email string `binding:"Required;Email;MaxSize(254)"`
|
||||
Password string `binding:"Required;MaxSize(255)"`
|
||||
Retype string
|
||||
LoginType string
|
||||
LoginName string
|
||||
}
|
||||
|
||||
func (f *RegisterForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -27,6 +27,10 @@ type ToggleOptions struct {
|
|||
|
||||
// AutoSignIn reads cookie and try to auto-login.
|
||||
func AutoSignIn(ctx *Context) (bool, error) {
|
||||
if !models.HasEngine {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
uname := ctx.GetCookie(setting.CookieUserName)
|
||||
if len(uname) == 0 {
|
||||
return false, nil
|
||||
|
|
|
@ -421,6 +421,7 @@ var Service struct {
|
|||
EnableReverseProxyAuth bool
|
||||
EnableReverseProxyAutoRegister bool
|
||||
DisableMinimumKeySizeCheck bool
|
||||
DisableCaptcha bool
|
||||
}
|
||||
|
||||
func newService() {
|
||||
|
@ -434,6 +435,7 @@ func newService() {
|
|||
Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
|
||||
Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
|
||||
Service.DisableMinimumKeySizeCheck = sec.Key("DISABLE_MINIMUM_KEY_SIZE_CHECK").MustBool()
|
||||
Service.DisableCaptcha = sec.Key("DISABLE_CAPTCHA").MustBool()
|
||||
}
|
||||
|
||||
var logLevels = map[string]string{
|
||||
|
|
2
public/css/gogs.min.css
vendored
2
public/css/gogs.min.css
vendored
File diff suppressed because one or more lines are too long
|
@ -147,11 +147,20 @@ function initInstall() {
|
|||
|
||||
// Database type change detection.
|
||||
$("#db_type").change(function () {
|
||||
var sqlite_default = 'data/gogs.db';
|
||||
var tidb_default = 'data/gogs_tidb';
|
||||
|
||||
var db_type = $(this).val();
|
||||
if (db_type === "SQLite3" || db_type === "TiDB") {
|
||||
$('#sql_settings').hide();
|
||||
$('#pgsql_settings').hide();
|
||||
$('#sqlite_settings').show();
|
||||
|
||||
if (db_type === "SQLite3" && $('#db_path').val() == tidb_default) {
|
||||
$('#db_path').val(sqlite_default);
|
||||
} else if (db_type === "TiDB" && $('#db_path').val() == sqlite_default) {
|
||||
$('#db_path').val(tidb_default);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -448,31 +457,46 @@ function initAdmin() {
|
|||
return;
|
||||
}
|
||||
|
||||
// New user
|
||||
if ($('.admin.new.user').length > 0) {
|
||||
$('#login_type').change(function () {
|
||||
if ($(this).val().substring(0, 1) == '0') {
|
||||
$('#login_name').removeAttr('required');
|
||||
$('#password').attr('required', 'required');
|
||||
$('.non-local').hide();
|
||||
$('.local').show();
|
||||
$('#user_name').focus();
|
||||
} else {
|
||||
$('#login_name').attr('required', 'required');
|
||||
$('#password').removeAttr('required');
|
||||
$('.non-local').show();
|
||||
$('.local').hide();
|
||||
$('#login_name').focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// New authentication
|
||||
if ($('.admin.new.authentication').length > 0) {
|
||||
$('#auth_type').change(function () {
|
||||
$('.ldap').hide();
|
||||
$('.dldap').hide();
|
||||
$('.smtp').hide();
|
||||
$('.pam').hide();
|
||||
|
||||
var auth_type = $(this).val();
|
||||
switch (auth_type) {
|
||||
case '2': // LDAP
|
||||
$('.dldap').hide();
|
||||
$('.smtp').hide();
|
||||
$('.pam').hide();
|
||||
$('.ldap').show();
|
||||
break;
|
||||
case '3': // SMTP
|
||||
$('.ldap').hide();
|
||||
$('.pam').hide();
|
||||
$('.smtp').show();
|
||||
break;
|
||||
case '4': // PAM
|
||||
$('.ldap').hide();
|
||||
$('.smtp').hide();
|
||||
$('.pam').show();
|
||||
break;
|
||||
case '5': // LDAP
|
||||
$('.ldap').hide();
|
||||
$('.smtp').hide();
|
||||
$('.pam').hide();
|
||||
$('.dldap').show();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
.signup {
|
||||
@input-padding: 200px!important;
|
||||
#create-page-form;
|
||||
form {
|
||||
width: 700px!important;
|
||||
.header {
|
||||
padding-left: @input-padding+30px;
|
||||
}
|
||||
.inline.field > label {
|
||||
width: @input-padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.repository {
|
||||
&.new.repo,
|
||||
&.new.migrate,
|
||||
|
|
|
@ -32,3 +32,8 @@
|
|||
color: #d9453d;
|
||||
}
|
||||
}
|
||||
|
||||
.signup {
|
||||
padding-top: 15px;
|
||||
padding-bottom: @footer-margin * 2;
|
||||
}
|
|
@ -29,9 +29,9 @@ func Authentications(ctx *middleware.Context) {
|
|||
ctx.Data["PageIsAdminAuthentications"] = true
|
||||
|
||||
var err error
|
||||
ctx.Data["Sources"], err = models.GetAuths()
|
||||
ctx.Data["Sources"], err = models.LoginSources()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetAuths", err)
|
||||
ctx.Handle(500, "LoginSources", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
package admin
|
||||
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/gogits/gogs/models"
|
||||
"github.com/gogits/gogs/modules/base"
|
||||
"github.com/gogits/gogs/modules/middleware"
|
||||
|
@ -14,6 +16,23 @@ const (
|
|||
REPOS base.TplName = "admin/repo/list"
|
||||
)
|
||||
|
||||
func pagination(ctx *middleware.Context, count int64, pageNum int) int {
|
||||
p := ctx.QueryInt("p")
|
||||
if p < 1 {
|
||||
p = 1
|
||||
}
|
||||
curCount := int64((p-1)*pageNum + pageNum)
|
||||
if curCount >= count {
|
||||
p = int(math.Ceil(float64(count) / float64(pageNum)))
|
||||
} else {
|
||||
ctx.Data["NextPageNum"] = p + 1
|
||||
}
|
||||
if p > 1 {
|
||||
ctx.Data["LastPageNum"] = p - 1
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func Repositories(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.repositories")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
package admin
|
||||
|
||||
import (
|
||||
"math"
|
||||
"strings"
|
||||
|
||||
"github.com/Unknwon/com"
|
||||
|
@ -25,23 +24,6 @@ const (
|
|||
USER_EDIT base.TplName = "admin/user/edit"
|
||||
)
|
||||
|
||||
func pagination(ctx *middleware.Context, count int64, pageNum int) int {
|
||||
p := ctx.QueryInt("p")
|
||||
if p < 1 {
|
||||
p = 1
|
||||
}
|
||||
curCount := int64((p-1)*pageNum + pageNum)
|
||||
if curCount >= count {
|
||||
p = int(math.Ceil(float64(count) / float64(pageNum)))
|
||||
} else {
|
||||
ctx.Data["NextPageNum"] = p + 1
|
||||
}
|
||||
if p > 1 {
|
||||
ctx.Data["LastPageNum"] = p - 1
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
func Users(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("admin.users")
|
||||
ctx.Data["PageIsAdmin"] = true
|
||||
|
@ -70,12 +52,14 @@ func NewUser(ctx *middleware.Context) {
|
|||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminUsers"] = true
|
||||
|
||||
auths, err := models.GetAuths()
|
||||
ctx.Data["login_type"] = "0-0"
|
||||
|
||||
sources, err := models.LoginSources()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetAuths", err)
|
||||
ctx.Handle(500, "LoginSources", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["LoginSources"] = auths
|
||||
ctx.Data["Sources"] = sources
|
||||
ctx.HTML(200, USER_NEW)
|
||||
}
|
||||
|
||||
|
@ -84,14 +68,15 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) {
|
|||
ctx.Data["PageIsAdmin"] = true
|
||||
ctx.Data["PageIsAdminUsers"] = true
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, USER_NEW)
|
||||
sources, err := models.LoginSources()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "LoginSources", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["Sources"] = sources
|
||||
|
||||
if form.Password != form.Retype {
|
||||
ctx.Data["Err_Password"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("form.password_not_match"), USER_NEW, &form)
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, USER_NEW)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -104,12 +89,12 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) {
|
|||
}
|
||||
|
||||
if len(form.LoginType) > 0 {
|
||||
// NOTE: need rewrite.
|
||||
fields := strings.Split(form.LoginType, "-")
|
||||
tp, _ := com.StrTo(fields[0]).Int()
|
||||
u.LoginType = models.LoginType(tp)
|
||||
u.LoginSource, _ = com.StrTo(fields[1]).Int64()
|
||||
u.LoginName = form.LoginName
|
||||
if len(fields) == 2 {
|
||||
u.LoginType = models.LoginType(com.StrTo(fields[0]).MustInt())
|
||||
u.LoginSource = com.StrTo(fields[1]).MustInt64()
|
||||
u.LoginName = form.LoginName
|
||||
}
|
||||
}
|
||||
|
||||
if err := models.CreateUser(u); err != nil {
|
||||
|
@ -132,7 +117,9 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) {
|
|||
return
|
||||
}
|
||||
log.Trace("Account created by admin(%s): %s", ctx.User.Name, u.Name)
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/users")
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name))
|
||||
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.Id))
|
||||
}
|
||||
|
||||
func EditUser(ctx *middleware.Context) {
|
||||
|
@ -151,14 +138,14 @@ func EditUser(ctx *middleware.Context) {
|
|||
ctx.Handle(500, "GetUserByID", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["User"] = u
|
||||
auths, err := models.GetAuths()
|
||||
|
||||
sources, err := models.LoginSources()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "GetAuths", err)
|
||||
ctx.Handle(500, "LoginSources", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["LoginSources"] = auths
|
||||
ctx.Data["LoginSources"] = sources
|
||||
ctx.HTML(200, USER_EDIT)
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,8 @@ func oauthSignUp(ctx *middleware.Context, sid int64) {
|
|||
func SignUp(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("sign_up")
|
||||
|
||||
ctx.Data["DisableCaptcha"] = setting.Service.DisableCaptcha
|
||||
|
||||
if setting.Service.DisableRegistration {
|
||||
ctx.Data["DisableRegistration"] = true
|
||||
ctx.HTML(200, SIGNUP)
|
||||
|
@ -168,6 +170,8 @@ func SignUp(ctx *middleware.Context) {
|
|||
func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.RegisterForm) {
|
||||
ctx.Data["Title"] = ctx.Tr("sign_up")
|
||||
|
||||
ctx.Data["DisableCaptcha"] = setting.Service.DisableCaptcha
|
||||
|
||||
if setting.Service.DisableRegistration {
|
||||
ctx.Error(403)
|
||||
return
|
||||
|
@ -179,36 +183,18 @@ func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.Registe
|
|||
ctx.Data["IsSocialLogin"] = true
|
||||
}
|
||||
|
||||
// May redirect from home page.
|
||||
if ctx.Query("from") == "home" {
|
||||
// Clear input error box.
|
||||
ctx.Data["Err_UserName"] = false
|
||||
ctx.Data["Err_Email"] = false
|
||||
|
||||
// Make the best guess.
|
||||
uname := ctx.Query("uname")
|
||||
i := strings.Index(uname, "@")
|
||||
if i > -1 {
|
||||
ctx.Data["email"] = uname
|
||||
ctx.Data["uname"] = uname[:i]
|
||||
} else {
|
||||
ctx.Data["uname"] = uname
|
||||
}
|
||||
ctx.Data["password"] = ctx.Query("password")
|
||||
ctx.HTML(200, SIGNUP)
|
||||
return
|
||||
}
|
||||
|
||||
if ctx.HasError() {
|
||||
ctx.HTML(200, SIGNUP)
|
||||
return
|
||||
}
|
||||
|
||||
if !cpt.VerifyReq(ctx.Req) {
|
||||
if !setting.Service.DisableCaptcha && !cpt.VerifyReq(ctx.Req) {
|
||||
ctx.Data["Err_Captcha"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("form.captcha_incorrect"), SIGNUP, &form)
|
||||
return
|
||||
} else if form.Password != form.Retype {
|
||||
}
|
||||
|
||||
if form.Password != form.Retype {
|
||||
ctx.Data["Err_Password"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("form.password_not_match"), SIGNUP, &form)
|
||||
return
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.6.11.0912 Beta
|
||||
0.6.11.0913 Beta
|
|
@ -1,58 +1,56 @@
|
|||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div id="admin-wrapper">
|
||||
<div id="setting-wrapper" class="main-wrapper">
|
||||
<div id="admin-setting" class="container clear">
|
||||
{{template "admin/nav" .}}
|
||||
<div class="grid-4-5 left">
|
||||
<div class="setting-content">
|
||||
{{template "ng/base/alert" .}}
|
||||
<div id="setting-content">
|
||||
<div class="panel panel-radius">
|
||||
<div class="panel-header">
|
||||
<strong>{{.i18n.Tr "admin.users.new_account"}}</strong>
|
||||
</div>
|
||||
<form class="form form-align panel-body" id="repo-setting-form" action="{{AppSubUrl}}/admin/users/new" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<div class="field">
|
||||
<label class="req">{{.i18n.Tr "admin.users.auth_source"}}</label>
|
||||
<select id="login-type" name="logintype">
|
||||
<option value="0-0">{{.i18n.Tr "admin.users.local"}}</option>
|
||||
{{range $key, $val := .LoginSources}}
|
||||
<option value="{{$val.Type}}-{{$val.ID}}">{{$val.Name}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="field auth-name hidden">
|
||||
<label class="req" for="loginname">{{.i18n.Tr "admin.users.auth_login_name"}}</label>
|
||||
<input class="ipt ipt-large ipt-radius {{if .Err_LoginName}}ipt-error{{end}}" id="loginname" name="loginname" value="{{.loginname}}" />
|
||||
</div>
|
||||
<div class="field">
|
||||
<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 />
|
||||
</div>
|
||||
<div class="field">
|
||||
<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/>
|
||||
</div>
|
||||
<div class="field pwd">
|
||||
<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 class="field">
|
||||
<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/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label></label>
|
||||
<button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "admin.users.new_account"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{template "base/head" .}}
|
||||
<div class="admin new user">
|
||||
<div class="ui container">
|
||||
<div class="ui grid">
|
||||
{{template "admin/navbar" .}}
|
||||
<div class="twelve wide column content">
|
||||
{{template "base/alert" .}}
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "admin.users.new_account"}}
|
||||
</h4>
|
||||
<div class="ui attached segment">
|
||||
<form class="ui form" action="{{.Link}}" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<!-- Types and name -->
|
||||
<div class="inline required field {{if .Err_LoginType}}error{{end}}">
|
||||
<label>{{.i18n.Tr "admin.users.auth_source"}}</label>
|
||||
<div class="ui selection type dropdown">
|
||||
<input type="hidden" id="login_type" name="login_type" value="{{.login_type}}-{{.login_id}}" required>
|
||||
<div class="text">{{.i18n.Tr "admin.users.local"}}</div>
|
||||
<i class="dropdown icon"></i>
|
||||
<div class="menu">
|
||||
<div class="item" data-value="0-0">{{.i18n.Tr "admin.users.local"}}</div>
|
||||
{{range .Sources}}
|
||||
<div class="item" data-value="{{.Type}}-{{.ID}}">{{.Name}}</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if not (eq .login_type "0-0")}}hide{{end}}">
|
||||
<label for="login_name">{{.i18n.Tr "admin.users.auth_login_name"}}</label>
|
||||
<input id="login_name" name="login_name" value="{{.login_name}}">
|
||||
</div>
|
||||
<div class="required field {{if .Err_UserName}}error{{end}}">
|
||||
<label for="user_name">{{.i18n.Tr "username"}}</label>
|
||||
<input id="user_name" name="user_name" value="{{.user_name}}" autofocus required>
|
||||
</div>
|
||||
<div class="required field {{if .Err_Email}}error{{end}}">
|
||||
<label for="email">{{.i18n.Tr "email"}}</label>
|
||||
<input id="email" name="email" type="email" value="{{.email}}" required>
|
||||
</div>
|
||||
<input class="fake" type="password">
|
||||
<div class="required local field {{if .Err_Password}}error{{end}} {{if eq .login_type "0-0"}}hide{{end}}">
|
||||
<label for="password">{{.i18n.Tr "password"}}</label>
|
||||
<input id="password" name="password" type="password" value="{{.password}}" required>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<button class="ui green button">{{.i18n.Tr "admin.users.new_account"}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "ng/base/footer" .}}
|
||||
{{template "base/footer" .}}
|
|
@ -1,49 +1,56 @@
|
|||
{{template "ng/base/head" .}}
|
||||
{{template "ng/base/header" .}}
|
||||
<div id="sign-wrapper">
|
||||
<form class="form-align form panel panel-radius sign-panel sign-form container" id="sign-up-form" action="{{AppSubUrl}}/user/sign_up" method="post">
|
||||
<div class="panel-header">
|
||||
<h2>{{if .IsSocialLogin}}{{.i18n.Tr "social_sign_in" | Str2html}}{{else}}{{.i18n.Tr "sign_up"}}{{end}}</h2>
|
||||
</div>
|
||||
<div class="panel-content">
|
||||
{{template "ng/base/alert" .}}
|
||||
{{template "base/head" .}}
|
||||
<div class="signup">
|
||||
<div class="ui middle very relaxed page grid">
|
||||
<div class="column">
|
||||
<form class="ui form" action="{{.Link}}" method="post">
|
||||
{{.CsrfTokenHtml}}
|
||||
<h3 class="ui top attached header">
|
||||
{{if .IsSocialLogin}}{{.i18n.Tr "social_sign_in" | Str2html}}{{else}}{{.i18n.Tr "sign_up"}}{{end}}
|
||||
</h3>
|
||||
<div class="ui attached segment">
|
||||
{{template "base/alert" .}}
|
||||
{{if .DisableRegistration}}
|
||||
<p>{{.i18n.Tr "auth.disable_register_prompt"}}</p>
|
||||
{{else}}
|
||||
<div class="field">
|
||||
<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/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<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 />
|
||||
</div>
|
||||
<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 class="field">
|
||||
<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/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label></label>
|
||||
{{.Captcha.CreateHtml}}
|
||||
</div>
|
||||
<div class="field">
|
||||
<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/>
|
||||
</div>
|
||||
<div class="field">
|
||||
<span class="form-label"></span>
|
||||
<button class="btn btn-blue btn-large btn-radius">{{.i18n.Tr "auth.create_new_account"}}</button>
|
||||
</div>
|
||||
<div class="field">
|
||||
<span class="form-label"></span>
|
||||
<a href="{{AppSubUrl}}/user/login">{{if .IsSocialLogin}}{{.i18n.Tr "auth.social_register_hepler_msg"}}{{else}}{{.i18n.Tr "auth.register_hepler_msg"}}{{end}}</a>
|
||||
</div>
|
||||
<div class="required inline field {{if .Err_UserName}}error{{end}}">
|
||||
<label for="user_name">{{.i18n.Tr "username"}}</label>
|
||||
<input id="user_name" name="user_name" value="{{.user_name}}" autofocus required>
|
||||
</div>
|
||||
<div class="required inline field {{if .Err_Email}}error{{end}}">
|
||||
<label for="email">{{.i18n.Tr "email"}}</label>
|
||||
<input id="email" name="email" type="email" value="{{.email}}" required>
|
||||
</div>
|
||||
<div class="required inline field {{if .Err_Password}}error{{end}}">
|
||||
<label for="password">{{.i18n.Tr "password"}}</label>
|
||||
<input id="password" name="password" type="password" value="{{.password}}" required>
|
||||
</div>
|
||||
<div class="required inline field {{if .Err_Password}}error{{end}}">
|
||||
<label for="retype">{{.i18n.Tr "re_type"}}</label>
|
||||
<input id="retype" name="retype" type="password" value="{{.retype}}" required>
|
||||
</div>
|
||||
{{if not .DisableCaptcha}}
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
{{.Captcha.CreateHtml}}
|
||||
</div>
|
||||
<div class="required inline field {{if .Err_Captcha}}error{{end}}">
|
||||
<label for="captcha">{{.i18n.Tr "captcha"}}</label>
|
||||
<input id="captcha" name="captcha" value="{{.captcha}}" autocomplete="off">
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<button class="ui green button">{{.i18n.Tr "auth.create_new_account"}}</button>
|
||||
</div>
|
||||
<div class="inline field">
|
||||
<label></label>
|
||||
<a href="{{AppSubUrl}}/user/login">{{if .IsSocialLogin}}{{.i18n.Tr "auth.social_register_hepler_msg"}}{{else}}{{.i18n.Tr "auth.register_hepler_msg"}}{{end}}</a>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{template "ng/base/footer" .}}
|
||||
{{template "base/footer" .}}
|
Loading…
Reference in a new issue