mirror of
https://github.com/go-gitea/gitea
synced 2024-08-20 06:11:16 +02:00
Merge branch 'master' of github.com:gogits/gogs into dev
This commit is contained in:
commit
5435b259cc
@ -53,7 +53,7 @@ RESET_PASSWD_CODE_LIVE_MINUTES = 180
|
|||||||
; User need to confirm e-mail for registration
|
; User need to confirm e-mail for registration
|
||||||
REGISTER_EMAIL_CONFIRM = false
|
REGISTER_EMAIL_CONFIRM = false
|
||||||
; Does not allow register and admin create account only
|
; Does not allow register and admin create account only
|
||||||
DISENABLE_REGISTERATION = false
|
DISABLE_REGISTRATION = false
|
||||||
; User must sign in to view anything.
|
; User must sign in to view anything.
|
||||||
REQUIRE_SIGNIN_VIEW = false
|
REQUIRE_SIGNIN_VIEW = false
|
||||||
; Cache avatar as picture
|
; Cache avatar as picture
|
||||||
|
@ -84,7 +84,7 @@ var (
|
|||||||
|
|
||||||
var Service struct {
|
var Service struct {
|
||||||
RegisterEmailConfirm bool
|
RegisterEmailConfirm bool
|
||||||
DisenableRegisteration bool
|
DisableRegistration bool
|
||||||
RequireSignInView bool
|
RequireSignInView bool
|
||||||
EnableCacheAvatar bool
|
EnableCacheAvatar bool
|
||||||
NotifyMail bool
|
NotifyMail bool
|
||||||
@ -116,7 +116,7 @@ var logLevels = map[string]string{
|
|||||||
func newService() {
|
func newService() {
|
||||||
Service.ActiveCodeLives = Cfg.MustInt("service", "ACTIVE_CODE_LIVE_MINUTES", 180)
|
Service.ActiveCodeLives = Cfg.MustInt("service", "ACTIVE_CODE_LIVE_MINUTES", 180)
|
||||||
Service.ResetPwdCodeLives = Cfg.MustInt("service", "RESET_PASSWD_CODE_LIVE_MINUTES", 180)
|
Service.ResetPwdCodeLives = Cfg.MustInt("service", "RESET_PASSWD_CODE_LIVE_MINUTES", 180)
|
||||||
Service.DisenableRegisteration = Cfg.MustBool("service", "DISENABLE_REGISTERATION", false)
|
Service.DisableRegistration = Cfg.MustBool("service", "DISABLE_REGISTRATION", false)
|
||||||
Service.RequireSignInView = Cfg.MustBool("service", "REQUIRE_SIGNIN_VIEW", false)
|
Service.RequireSignInView = Cfg.MustBool("service", "REQUIRE_SIGNIN_VIEW", false)
|
||||||
Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR", false)
|
Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR", false)
|
||||||
}
|
}
|
||||||
|
@ -169,8 +169,8 @@ func SignUp(ctx *middleware.Context) {
|
|||||||
ctx.Data["Title"] = "Sign Up"
|
ctx.Data["Title"] = "Sign Up"
|
||||||
ctx.Data["PageIsSignUp"] = true
|
ctx.Data["PageIsSignUp"] = true
|
||||||
|
|
||||||
if base.Service.DisenableRegisteration {
|
if base.Service.DisableRegistration {
|
||||||
ctx.Data["DisenableRegisteration"] = true
|
ctx.Data["DisableRegistration"] = true
|
||||||
ctx.HTML(200, "user/signup")
|
ctx.HTML(200, "user/signup")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) {
|
|||||||
ctx.Data["Title"] = "Sign Up"
|
ctx.Data["Title"] = "Sign Up"
|
||||||
ctx.Data["PageIsSignUp"] = true
|
ctx.Data["PageIsSignUp"] = true
|
||||||
|
|
||||||
if base.Service.DisenableRegisteration {
|
if base.Service.DisableRegistration {
|
||||||
ctx.Handle(403, "user.SignUpPost", nil)
|
ctx.Handle(403, "user.SignUpPost", nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
10
serve.go
10
serve.go
@ -116,8 +116,8 @@ func runServ(k *cli.Context) {
|
|||||||
repoPath := strings.Trim(args, "'")
|
repoPath := strings.Trim(args, "'")
|
||||||
rr := strings.SplitN(repoPath, "/", 2)
|
rr := strings.SplitN(repoPath, "/", 2)
|
||||||
if len(rr) != 2 {
|
if len(rr) != 2 {
|
||||||
println("Unavilable repository", args)
|
println("Unavailable repository", args)
|
||||||
qlog.Fatalf("Unavilable repository %v", args)
|
qlog.Fatalf("Unavailable repository %v", args)
|
||||||
}
|
}
|
||||||
repoUserName := rr[0]
|
repoUserName := rr[0]
|
||||||
repoName := strings.TrimSuffix(rr[1], ".git")
|
repoName := strings.TrimSuffix(rr[1], ".git")
|
||||||
@ -136,7 +136,7 @@ func runServ(k *cli.Context) {
|
|||||||
case isWrite:
|
case isWrite:
|
||||||
has, err := models.HasAccess(user.LowerName, path.Join(repoUserName, repoName), models.AU_WRITABLE)
|
has, err := models.HasAccess(user.LowerName, path.Join(repoUserName, repoName), models.AU_WRITABLE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println("Inernel error:", err)
|
println("Internal error:", err)
|
||||||
qlog.Fatal(err)
|
qlog.Fatal(err)
|
||||||
} else if !has {
|
} else if !has {
|
||||||
println("You have no right to write this repository")
|
println("You have no right to write this repository")
|
||||||
@ -155,13 +155,13 @@ func runServ(k *cli.Context) {
|
|||||||
|
|
||||||
has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.AU_READABLE)
|
has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.AU_READABLE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println("Inernel error")
|
println("Internal error")
|
||||||
qlog.Fatal(err)
|
qlog.Fatal(err)
|
||||||
}
|
}
|
||||||
if !has {
|
if !has {
|
||||||
has, err = models.HasAccess(user.Name, repoPath, models.AU_WRITABLE)
|
has, err = models.HasAccess(user.Name, repoPath, models.AU_WRITABLE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println("Inernel error")
|
println("Internal error")
|
||||||
qlog.Fatal(err)
|
qlog.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,8 @@
|
|||||||
<dl class="dl-horizontal admin-dl-horizontal">
|
<dl class="dl-horizontal admin-dl-horizontal">
|
||||||
<dt>Register Email Confirmation</dt>
|
<dt>Register Email Confirmation</dt>
|
||||||
<dd><i class="fa fa{{if .Service.RegisterEmailConfirm}}-check{{end}}-square-o"></i></dd>
|
<dd><i class="fa fa{{if .Service.RegisterEmailConfirm}}-check{{end}}-square-o"></i></dd>
|
||||||
<dt>Disenable Registeration</dt>
|
<dt>Disable Registration</dt>
|
||||||
<dd><i class="fa fa{{if .Service.DisenableRegisteration}}-check{{end}}-square-o"></i></dd>
|
<dd><i class="fa fa{{if .Service.DisableRegistration}}-check{{end}}-square-o"></i></dd>
|
||||||
<dt>Require Sign In View</dt>
|
<dt>Require Sign In View</dt>
|
||||||
<dd><i class="fa fa{{if .Service.RequireSignInView}}-check{{end}}-square-o"></i></dd>
|
<dd><i class="fa fa{{if .Service.RequireSignInView}}-check{{end}}-square-o"></i></dd>
|
||||||
<dt>Mail Notification</dt>
|
<dt>Mail Notification</dt>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<div class="container" id="body">
|
<div class="container" id="body">
|
||||||
<form action="/user/sign_up" method="post" class="form-horizontal card" id="login-card">
|
<form action="/user/sign_up" method="post" class="form-horizontal card" id="login-card">
|
||||||
{{.CsrfTokenHtml}}
|
{{.CsrfTokenHtml}}
|
||||||
{{if .DisenableRegisteration}}
|
{{if .DisableRegistration}}
|
||||||
Sorry, registration has been disabled. Please contact the site administrator.
|
Sorry, registration has been disabled. Please contact the site administrator.
|
||||||
{{else}}
|
{{else}}
|
||||||
{{if .IsSocialLogin}}
|
{{if .IsSocialLogin}}
|
||||||
|
Loading…
Reference in New Issue
Block a user