mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 14:43:52 +03:00
parent
e5ed5904c6
commit
83e747bfda
15 changed files with 183 additions and 156 deletions
|
@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
||||||
|
|
||||||
![](public/img/gogs-large-resize.png)
|
![](public/img/gogs-large-resize.png)
|
||||||
|
|
||||||
##### Current version: 0.6.11 Beta
|
##### Current version: 0.6.12 Beta
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -99,8 +99,8 @@ ENABLE_REVERSE_PROXY_AUTHENTICATION = false
|
||||||
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
|
ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = false
|
||||||
; Do not check minimum key size with corresponding type
|
; Do not check minimum key size with corresponding type
|
||||||
DISABLE_MINIMUM_KEY_SIZE_CHECK = false
|
DISABLE_MINIMUM_KEY_SIZE_CHECK = false
|
||||||
; Disable captcha validation for registration
|
; Enable captcha validation for registration
|
||||||
DISABLE_CAPTCHA = false
|
ENABLE_CAPTCHA = true
|
||||||
|
|
||||||
[webhook]
|
[webhook]
|
||||||
; Hook task queue length
|
; Hook task queue length
|
||||||
|
|
|
@ -785,6 +785,7 @@ users.edit = Edit
|
||||||
users.auth_source = Authentication Source
|
users.auth_source = Authentication Source
|
||||||
users.local = Local
|
users.local = Local
|
||||||
users.auth_login_name = Authentication Login Name
|
users.auth_login_name = Authentication Login Name
|
||||||
|
users.password_helper = Leave it empty to remain unchanged.
|
||||||
users.update_profile_success = Account profile has been updated successfully.
|
users.update_profile_success = Account profile has been updated successfully.
|
||||||
users.edit_account = Edit Account
|
users.edit_account = Edit Account
|
||||||
users.is_activated = This account is activated
|
users.is_activated = This account is activated
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.6.11.0913 Beta"
|
const APP_VER = "0.6.12.0913 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -10,17 +10,29 @@ import (
|
||||||
"github.com/macaron-contrib/binding"
|
"github.com/macaron-contrib/binding"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type AdminCrateUserForm struct {
|
||||||
|
LoginType string `binding:"Required"`
|
||||||
|
LoginName string
|
||||||
|
UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
|
||||||
|
Email string `binding:"Required;Email;MaxSize(254)"`
|
||||||
|
Password string `binding:"MaxSize(255)"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *AdminCrateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||||
|
return validate(errs, ctx.Data, f, ctx.Locale)
|
||||||
|
}
|
||||||
|
|
||||||
type AdminEditUserForm struct {
|
type AdminEditUserForm struct {
|
||||||
FullName string `form:"fullname" binding:"MaxSize(100)"`
|
LoginType string `binding:"Required"`
|
||||||
|
LoginName string
|
||||||
|
FullName string `binding:"MaxSize(100)"`
|
||||||
Email string `binding:"Required;Email;MaxSize(254)"`
|
Email string `binding:"Required;Email;MaxSize(254)"`
|
||||||
Password string `binding:"OmitEmpty;MinSize(6);MaxSize(255)"`
|
Password string `binding:"MaxSize(255)"`
|
||||||
Website string `binding:"MaxSize(50)"`
|
Website string `binding:"MaxSize(50)"`
|
||||||
Location string `binding:"MaxSize(50)"`
|
Location string `binding:"MaxSize(50)"`
|
||||||
Avatar string `binding:"Required;Email;MaxSize(50)"`
|
|
||||||
Active bool
|
Active bool
|
||||||
Admin bool
|
Admin bool
|
||||||
AllowGitHook bool
|
AllowGitHook bool
|
||||||
LoginType int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
func (f *AdminEditUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||||
|
|
|
@ -78,18 +78,6 @@ func (f *SignInForm) Validate(ctx *macaron.Context, errs binding.Errors) binding
|
||||||
return validate(errs, ctx.Data, f, ctx.Locale)
|
return validate(errs, ctx.Data, f, ctx.Locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
type AdminCrateUserForm struct {
|
|
||||||
UserName string `binding:"Required;AlphaDashDot;MaxSize(35)"`
|
|
||||||
Email string `binding:"Required;Email;MaxSize(254)"`
|
|
||||||
Password string `binding:"MaxSize(255)"`
|
|
||||||
LoginType string
|
|
||||||
LoginName string
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *AdminCrateUserForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
|
||||||
return validate(errs, ctx.Data, f, ctx.Locale)
|
|
||||||
}
|
|
||||||
|
|
||||||
// __________________________________________.___ _______ ________ _________
|
// __________________________________________.___ _______ ________ _________
|
||||||
// / _____/\_ _____/\__ ___/\__ ___/| |\ \ / _____/ / _____/
|
// / _____/\_ _____/\__ ___/\__ ___/| |\ \ / _____/ / _____/
|
||||||
// \_____ \ | __)_ | | | | | |/ | \/ \ ___ \_____ \
|
// \_____ \ | __)_ | | | | | |/ | \/ \ ___ \_____ \
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -421,7 +421,7 @@ var Service struct {
|
||||||
EnableReverseProxyAuth bool
|
EnableReverseProxyAuth bool
|
||||||
EnableReverseProxyAutoRegister bool
|
EnableReverseProxyAutoRegister bool
|
||||||
DisableMinimumKeySizeCheck bool
|
DisableMinimumKeySizeCheck bool
|
||||||
DisableCaptcha bool
|
EnableCaptcha bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newService() {
|
func newService() {
|
||||||
|
@ -435,7 +435,7 @@ func newService() {
|
||||||
Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
|
Service.EnableReverseProxyAuth = sec.Key("ENABLE_REVERSE_PROXY_AUTHENTICATION").MustBool()
|
||||||
Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
|
Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
|
||||||
Service.DisableMinimumKeySizeCheck = sec.Key("DISABLE_MINIMUM_KEY_SIZE_CHECK").MustBool()
|
Service.DisableMinimumKeySizeCheck = sec.Key("DISABLE_MINIMUM_KEY_SIZE_CHECK").MustBool()
|
||||||
Service.DisableCaptcha = sec.Key("DISABLE_CAPTCHA").MustBool()
|
Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool()
|
||||||
}
|
}
|
||||||
|
|
||||||
var logLevels = map[string]string{
|
var logLevels = map[string]string{
|
||||||
|
|
|
@ -458,20 +458,26 @@ function initAdmin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// New user
|
// New user
|
||||||
if ($('.admin.new.user').length > 0) {
|
if ($('.admin.new.user').length > 0 ||
|
||||||
|
$('.admin.edit.user').length > 0) {
|
||||||
$('#login_type').change(function () {
|
$('#login_type').change(function () {
|
||||||
if ($(this).val().substring(0, 1) == '0') {
|
if ($(this).val().substring(0, 1) == '0') {
|
||||||
$('#login_name').removeAttr('required');
|
$('#login_name').removeAttr('required');
|
||||||
$('#password').attr('required', 'required');
|
|
||||||
$('.non-local').hide();
|
$('.non-local').hide();
|
||||||
$('.local').show();
|
$('.local').show();
|
||||||
$('#user_name').focus();
|
$('#user_name').focus();
|
||||||
|
|
||||||
|
if($(this).data('password')=="required"){
|
||||||
|
$('#password').attr('required', 'required');
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#login_name').attr('required', 'required');
|
$('#login_name').attr('required', 'required');
|
||||||
$('#password').removeAttr('required');
|
|
||||||
$('.non-local').show();
|
$('.non-local').show();
|
||||||
$('.local').hide();
|
$('.local').hide();
|
||||||
$('#login_name').focus();
|
$('#login_name').focus();
|
||||||
|
|
||||||
|
$('#password').removeAttr('required');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,30 +122,44 @@ func NewUserPost(ctx *middleware.Context, form auth.AdminCrateUserForm) {
|
||||||
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.Id))
|
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + com.ToStr(u.Id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func prepareUserInfo(ctx *middleware.Context) *models.User {
|
||||||
|
u, err := models.GetUserByID(ctx.ParamsInt64(":userid"))
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetUserByID", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
ctx.Data["User"] = u
|
||||||
|
|
||||||
|
if u.LoginSource > 0 {
|
||||||
|
ctx.Data["LoginSource"], err = models.GetLoginSourceByID(u.LoginSource)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "GetLoginSourceByID", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ctx.Data["LoginSource"] = &models.LoginSource{}
|
||||||
|
}
|
||||||
|
|
||||||
|
sources, err := models.LoginSources()
|
||||||
|
if err != nil {
|
||||||
|
ctx.Handle(500, "LoginSources", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
ctx.Data["Sources"] = sources
|
||||||
|
|
||||||
|
return u
|
||||||
|
}
|
||||||
|
|
||||||
func EditUser(ctx *middleware.Context) {
|
func EditUser(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
|
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
|
||||||
ctx.Data["PageIsAdmin"] = true
|
ctx.Data["PageIsAdmin"] = true
|
||||||
ctx.Data["PageIsAdminUsers"] = true
|
ctx.Data["PageIsAdminUsers"] = true
|
||||||
|
|
||||||
uid := com.StrTo(ctx.Params(":userid")).MustInt64()
|
prepareUserInfo(ctx)
|
||||||
if uid == 0 {
|
if ctx.Written() {
|
||||||
ctx.Handle(404, "EditUser", nil)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := models.GetUserByID(uid)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "GetUserByID", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["User"] = u
|
|
||||||
|
|
||||||
sources, err := models.LoginSources()
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "LoginSources", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["LoginSources"] = sources
|
|
||||||
ctx.HTML(200, USER_EDIT)
|
ctx.HTML(200, USER_EDIT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,25 +168,28 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
|
||||||
ctx.Data["PageIsAdmin"] = true
|
ctx.Data["PageIsAdmin"] = true
|
||||||
ctx.Data["PageIsAdminUsers"] = true
|
ctx.Data["PageIsAdminUsers"] = true
|
||||||
|
|
||||||
uid := com.StrTo(ctx.Params(":userid")).MustInt64()
|
u := prepareUserInfo(ctx)
|
||||||
if uid == 0 {
|
if ctx.Written() {
|
||||||
ctx.Handle(404, "EditUser", nil)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u, err := models.GetUserByID(uid)
|
|
||||||
if err != nil {
|
|
||||||
ctx.Handle(500, "GetUserById", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ctx.Data["User"] = u
|
|
||||||
|
|
||||||
if ctx.HasError() {
|
if ctx.HasError() {
|
||||||
ctx.HTML(200, USER_EDIT)
|
ctx.HTML(200, USER_EDIT)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: need password length check
|
fields := strings.Split(form.LoginType, "-")
|
||||||
|
if len(fields) == 2 {
|
||||||
|
loginType := models.LoginType(com.StrTo(fields[0]).MustInt())
|
||||||
|
loginSource := com.StrTo(fields[1]).MustInt64()
|
||||||
|
|
||||||
|
if u.LoginSource != loginSource {
|
||||||
|
u.LoginSource = loginSource
|
||||||
|
u.LoginType = loginType
|
||||||
|
u.LoginName = form.LoginName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if len(form.Password) > 0 {
|
if len(form.Password) > 0 {
|
||||||
u.Passwd = form.Password
|
u.Passwd = form.Password
|
||||||
u.Salt = models.GetUserSalt()
|
u.Salt = models.GetUserSalt()
|
||||||
|
@ -183,11 +200,6 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
|
||||||
u.Email = form.Email
|
u.Email = form.Email
|
||||||
u.Website = form.Website
|
u.Website = form.Website
|
||||||
u.Location = form.Location
|
u.Location = form.Location
|
||||||
if len(form.Avatar) == 0 {
|
|
||||||
form.Avatar = form.Email
|
|
||||||
}
|
|
||||||
u.Avatar = base.EncodeMd5(form.Avatar)
|
|
||||||
u.AvatarEmail = form.Avatar
|
|
||||||
u.IsActive = form.Active
|
u.IsActive = form.Active
|
||||||
u.IsAdmin = form.Admin
|
u.IsAdmin = form.Admin
|
||||||
u.AllowGitHook = form.AllowGitHook
|
u.AllowGitHook = form.AllowGitHook
|
||||||
|
@ -202,6 +214,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Trace("Account profile updated by admin(%s): %s", ctx.User.Name, u.Name)
|
log.Trace("Account profile updated by admin(%s): %s", ctx.User.Name, u.Name)
|
||||||
|
|
||||||
ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success"))
|
ctx.Flash.Success(ctx.Tr("admin.users.update_profile_success"))
|
||||||
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
|
ctx.Redirect(setting.AppSubUrl + "/admin/users/" + ctx.Params(":userid"))
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ func oauthSignUp(ctx *middleware.Context, sid int64) {
|
||||||
func SignUp(ctx *middleware.Context) {
|
func SignUp(ctx *middleware.Context) {
|
||||||
ctx.Data["Title"] = ctx.Tr("sign_up")
|
ctx.Data["Title"] = ctx.Tr("sign_up")
|
||||||
|
|
||||||
ctx.Data["DisableCaptcha"] = setting.Service.DisableCaptcha
|
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
|
||||||
|
|
||||||
if setting.Service.DisableRegistration {
|
if setting.Service.DisableRegistration {
|
||||||
ctx.Data["DisableRegistration"] = true
|
ctx.Data["DisableRegistration"] = true
|
||||||
|
@ -170,7 +170,7 @@ func SignUp(ctx *middleware.Context) {
|
||||||
func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.RegisterForm) {
|
func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.RegisterForm) {
|
||||||
ctx.Data["Title"] = ctx.Tr("sign_up")
|
ctx.Data["Title"] = ctx.Tr("sign_up")
|
||||||
|
|
||||||
ctx.Data["DisableCaptcha"] = setting.Service.DisableCaptcha
|
ctx.Data["EnableCaptcha"] = setting.Service.EnableCaptcha
|
||||||
|
|
||||||
if setting.Service.DisableRegistration {
|
if setting.Service.DisableRegistration {
|
||||||
ctx.Error(403)
|
ctx.Error(403)
|
||||||
|
@ -188,7 +188,7 @@ func SignUpPost(ctx *middleware.Context, cpt *captcha.Captcha, form auth.Registe
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !setting.Service.DisableCaptcha && !cpt.VerifyReq(ctx.Req) {
|
if setting.Service.EnableCaptcha && !cpt.VerifyReq(ctx.Req) {
|
||||||
ctx.Data["Err_Captcha"] = true
|
ctx.Data["Err_Captcha"] = true
|
||||||
ctx.RenderWithErr(ctx.Tr("form.captcha_incorrect"), SIGNUP, &form)
|
ctx.RenderWithErr(ctx.Tr("form.captcha_incorrect"), SIGNUP, &form)
|
||||||
return
|
return
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.6.11.0913 Beta
|
0.6.12.0913 Beta
|
|
@ -1,93 +1,100 @@
|
||||||
{{template "ng/base/head" .}}
|
{{template "base/head" .}}
|
||||||
{{template "ng/base/header" .}}
|
<div class="admin edit user">
|
||||||
<div id="admin-wrapper">
|
<div class="ui container">
|
||||||
<div id="setting-wrapper" class="main-wrapper">
|
<div class="ui grid">
|
||||||
<div id="admin-setting" class="container clear">
|
{{template "admin/navbar" .}}
|
||||||
{{template "admin/nav" .}}
|
<div class="twelve wide column content">
|
||||||
<div class="grid-4-5 left">
|
{{template "base/alert" .}}
|
||||||
<div class="setting-content">
|
<h4 class="ui top attached header">
|
||||||
{{template "ng/base/alert" .}}
|
{{.i18n.Tr "admin.users.edit_account"}}
|
||||||
<div id="setting-content">
|
</h4>
|
||||||
<div class="panel panel-radius">
|
<div class="ui attached segment">
|
||||||
<div class="panel-header">
|
<form class="ui form" action="{{.Link}}" method="post">
|
||||||
<strong>{{.i18n.Tr "admin.users.edit_account"}}</strong>
|
{{.CsrfTokenHtml}}
|
||||||
</div>
|
<div class="inline field {{if .Err_UserName}}error{{end}}">
|
||||||
<form class="form form-align panel-body" id="user-profile-form" action="{{AppSubUrl}}/admin/users/{{.User.Id}}" method="post" data-delete-url="{{AppSubUrl}}/admin/users/{{.User.Id}}/delete">
|
<label for="user_name">{{.i18n.Tr "username"}}</label>
|
||||||
{{.CsrfTokenHtml}}
|
<span>{{.User.Name}}</span>
|
||||||
<div class="field">
|
</div>
|
||||||
<label class="req">{{.i18n.Tr "admin.users.auth_source"}}</label>
|
<!-- Types and name -->
|
||||||
<select id="login-type" name="logintype">
|
<div class="inline required field {{if .Err_LoginType}}error{{end}}">
|
||||||
<option value="0-0">{{.i18n.Tr "admin.users.local"}}</option>
|
<label>{{.i18n.Tr "admin.users.auth_source"}}</label>
|
||||||
{{$tp := .User.LoginSource}}
|
<div class="ui selection type dropdown">
|
||||||
{{range $key, $val := .LoginSources}}
|
<input type="hidden" id="login_type" name="login_type" value="{{.LoginSource.Type}}-{{.LoginSource.ID}}" required>
|
||||||
<option value="{{$val.Type}}-{{$val.ID}}"{{if eq $val.ID $tp}} selected{{end}}>{{$val.Name}}</option>
|
<div class="text">{{.i18n.Tr "admin.users.local"}}</div>
|
||||||
{{end}}
|
<i class="dropdown icon"></i>
|
||||||
</select>
|
<div class="menu">
|
||||||
</div>
|
<div class="item" data-value="0-0">{{.i18n.Tr "admin.users.local"}}</div>
|
||||||
<div class="field">
|
{{range .Sources}}
|
||||||
<label for="loginname">{{.i18n.Tr "admin.users.auth_login_name"}}</label>
|
<div class="item" data-value="{{.Type}}-{{.ID}}">{{.Name}}</div>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_LoginName}}ipt-error{{end}}" id="loginname" name="loginname" value="{{.User.LoginName}}" />
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
</div>
|
||||||
<label>{{.i18n.Tr "username"}}</label>
|
</div>
|
||||||
<label class="text-left">{{.User.Name}}</label>
|
<div class="required non-local field {{if .Err_LoginName}}error{{end}} {{if eq .User.LoginSource 0}}hide{{end}}">
|
||||||
</div>
|
<label for="login_name">{{.i18n.Tr "admin.users.auth_login_name"}}</label>
|
||||||
<div class="field">
|
<input id="login_name" name="login_name" value="{{.User.LoginName}}" autofocus>
|
||||||
<label for="full-name">{{.i18n.Tr "settings.full_name"}}</label>
|
</div>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_FullName}}ipt-error{{end}}" id="full-name" name="fullname" type="text" value="{{.User.FullName}}" />
|
<div class="field {{if .Err_FullName}}error{{end}}">
|
||||||
</div>
|
<label for="full_name">{{.i18n.Tr "settings.full_name"}}</label>
|
||||||
<div class="field">
|
<input id="full_name" name="full_name" value="{{.User.FullName}}">
|
||||||
<label class="req" for="email">{{.i18n.Tr "email"}}</label>
|
</div>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.User.Email}}" required/>
|
<div class="required field {{if .Err_Email}}error{{end}}">
|
||||||
</div>
|
<label for="email">{{.i18n.Tr "email"}}</label>
|
||||||
<div class="field pwd">
|
<input id="email" name="email" type="email" value="{{.User.Email}}" autofocus required>
|
||||||
<label for="password">{{.i18n.Tr "password"}}</label>
|
</div>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Password}}ipt-error{{end}}" id="password" name="password" type="password" />
|
<input class="fake" type="password">
|
||||||
</div>
|
<div class="local field {{if .Err_Password}}error{{end}} {{if not (eq .User.LoginSource 0)}}hide{{end}}">
|
||||||
<div class="field">
|
<label for="password">{{.i18n.Tr "password"}}</label>
|
||||||
<label for="website">{{.i18n.Tr "settings.website"}}</label>
|
<input id="password" name="password" type="password">
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Website}}ipt-error{{end}}" id="website" name="website" type="url" value="{{.User.Website}}" />
|
<p class="help">{{.i18n.Tr "admin.users.password_helper"}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field {{if .Err_Website}}error{{end}}">
|
||||||
<label for="location">{{.i18n.Tr "settings.location"}}</label>
|
<label for="website">{{.i18n.Tr "settings.website"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Location}}ipt-error{{end}}" id="location" name="location" type="text" value="{{.User.Location}}" />
|
<input id="website" name="website" type="url" value="{{.User.Website}}" placeholder="e.g. http://mydomain.com or https://mydomain.com">
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field {{if .Err_Location}}error{{end}}">
|
||||||
<label for="gravatar-email">Gravatar {{.i18n.Tr "email"}}</label>
|
<label for="location">{{.i18n.Tr "settings.location"}}</label>
|
||||||
<input class="ipt ipt-large ipt-radius {{if .Err_Avatar}}ipt-error{{end}}" id="gravatar-email" name="avatar" type="text" value="{{.User.AvatarEmail}}" />
|
<input id="location" name="location" value="{{.User.Location}}">
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
|
||||||
<label></label>
|
<div class="inline field">
|
||||||
<input type="checkbox" name="active" {{if .User.IsActive}}checked{{end}}>
|
<div class="ui checkbox">
|
||||||
<strong>{{.i18n.Tr "admin.users.is_activated"}}</strong>
|
<label><strong>{{.i18n.Tr "admin.users.is_activated"}}</strong></label>
|
||||||
<br>
|
<input name="active" type="checkbox" {{if .User.IsActive}}checked{{end}}>
|
||||||
<label></label>
|
</div>
|
||||||
<input type="checkbox" name="admin" {{if .User.IsAdmin}}checked{{end}}>
|
</div>
|
||||||
<strong>{{.i18n.Tr "admin.users.is_admin"}}</strong>
|
<div class="inline field">
|
||||||
<br>
|
<div class="ui checkbox">
|
||||||
<label></label>
|
<label><strong>{{.i18n.Tr "admin.users.is_admin"}}</strong></label>
|
||||||
<input type="checkbox" name="allow_git_hook" {{if .User.AllowGitHook}}checked{{end}}>
|
<input name="admin" type="checkbox" {{if .User.IsAdmin}}checked{{end}}>
|
||||||
<strong>{{.i18n.Tr "admin.users.allow_git_hook"}}</strong>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="inline field">
|
||||||
<label></label>
|
<div class="ui checkbox">
|
||||||
<button class="btn btn-green btn-large btn-radius">{{.i18n.Tr "admin.users.update_profile"}}</button>
|
<label><strong>{{.i18n.Tr "admin.users.allow_git_hook"}}</strong></label>
|
||||||
|
<input name="allow_git_hook" type="checkbox" {{if or .User.IsAdmin .User.AllowGitHook}}checked{{end}}>
|
||||||
<button class="btn btn-large btn-red btn-radius" id="delete-account-btn" href="#delete-account-modal">{{.i18n.Tr "admin.users.delete_account"}}</button>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="white-popup-block mfp-hide" id="delete-account-modal">
|
|
||||||
<h1 class="text-red">{{.i18n.Tr "settings.delete_account_title"}}</h1>
|
<div class="field">
|
||||||
<p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
|
<button class="ui green button">{{.i18n.Tr "admin.users.update_profile"}}</button>
|
||||||
<br>
|
<div class="ui red button delete-button" data-url="{{$.Link}}/delete" data-id="{{.User.Id}}">{{.i18n.Tr "admin.users.delete_account"}}</div>
|
||||||
<button class="btn btn-red btn-large btn-radius" id="delete-account-submit">{{.i18n.Tr "settings.continue"}}</button>
|
</div>
|
||||||
<button class="btn btn-large btn-radius popup-modal-dismiss">{{.i18n.Tr "settings.cancel"}}</button>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{template "ng/base/footer" .}}
|
|
||||||
|
<div class="ui small basic delete modal">
|
||||||
|
<div class="ui icon header">
|
||||||
|
<i class="trash icon"></i>
|
||||||
|
{{.i18n.Tr "settings.delete_account_title"}}
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<p>{{.i18n.Tr "settings.delete_account_desc"}}</p>
|
||||||
|
</div>
|
||||||
|
{{template "base/delete_modal_actions" .}}
|
||||||
|
</div>
|
||||||
|
{{template "base/footer" .}}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<div class="inline required field {{if .Err_LoginType}}error{{end}}">
|
<div class="inline required field {{if .Err_LoginType}}error{{end}}">
|
||||||
<label>{{.i18n.Tr "admin.users.auth_source"}}</label>
|
<label>{{.i18n.Tr "admin.users.auth_source"}}</label>
|
||||||
<div class="ui selection type dropdown">
|
<div class="ui selection type dropdown">
|
||||||
<input type="hidden" id="login_type" name="login_type" value="{{.login_type}}" required>
|
<input type="hidden" id="login_type" name="login_type" value="{{.login_type}}" data-password="required" required>
|
||||||
<div class="text">{{.i18n.Tr "admin.users.local"}}</div>
|
<div class="text">{{.i18n.Tr "admin.users.local"}}</div>
|
||||||
<i class="dropdown icon"></i>
|
<i class="dropdown icon"></i>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<label for="retype">{{.i18n.Tr "re_type"}}</label>
|
<label for="retype">{{.i18n.Tr "re_type"}}</label>
|
||||||
<input id="retype" name="retype" type="password" value="{{.retype}}" required>
|
<input id="retype" name="retype" type="password" value="{{.retype}}" required>
|
||||||
</div>
|
</div>
|
||||||
{{if not .DisableCaptcha}}
|
{{if .EnableCaptcha}}
|
||||||
<div class="inline field">
|
<div class="inline field">
|
||||||
<label></label>
|
<label></label>
|
||||||
{{.Captcha.CreateHtml}}
|
{{.Captcha.CreateHtml}}
|
||||||
|
|
Loading…
Reference in a new issue