Browse Source

#697 add install option

for-closed-social
Unknwon 9 years ago
parent
commit
5f1183cecf
7 changed files with 27 additions and 6 deletions
  1. +2
    -0
      conf/locale/locale_en-US.ini
  2. +1
    -1
      conf/locale/locale_zh-CN.ini
  3. +1
    -0
      modules/auth/user_form.go
  4. +4
    -4
      modules/bindata/bindata.go
  5. +10
    -0
      public/js/gogs.js
  6. +2
    -0
      routers/install.go
  7. +7
    -1
      templates/install.tmpl

+ 2
- 0
conf/locale/locale_en-US.ini View File

@ -102,6 +102,8 @@ disable_gravatar = Disable Gravatar Service
disable_gravatar_popup = Disable Gravatar and custom sources, all avatars are uploaded by users or default.
disable_registration = Disable Self-registration
disable_registration_popup = Disable user self-registration, only admin can create accounts.
enable_captcha = Enable Captcha
enable_captcha_popup = Require validate captcha for user self-registration.
require_sign_in_view = Enable Require Sign In to View Pages
require_sign_in_view_popup = Only signed in users can view pages, visitors will only be able to see sign in/up pages.
admin_setting_desc = You do not have to create an admin account right now, user whoever ID=1 will gain admin access automatically.

+ 1
- 1
conf/locale/locale_zh-CN.ini View File

@ -721,7 +721,7 @@ notices=系统提示管理
monitor=应用监控面板
first_page=首页
last_page=末页
total=总计:
total=总计:%d
dashboard.statistic=应用统计数据
dashboard.operations=管理员操作

+ 1
- 0
modules/auth/user_form.go View File

@ -38,6 +38,7 @@ type InstallForm struct {
OfflineMode bool
DisableGravatar bool
DisableRegistration bool
EnableCaptcha bool
RequireSignInView bool
AdminName string `binding:"OmitEmpty;AlphaDashDot;MaxSize(30)" locale:"install.admin_name"`

+ 4
- 4
modules/bindata/bindata.go
File diff suppressed because it is too large
View File


+ 10
- 0
public/js/gogs.js View File

@ -187,6 +187,16 @@ function initInstall() {
$('#disable-gravatar').checkbox('check');
}
});
$('#disable-registration input').change(function () {
if ($(this).is(':checked')) {
$('#enable-captcha').checkbox('uncheck');
}
});
$('#enable-captcha input').change(function () {
if ($(this).is(':checked')) {
$('#disable-registration').checkbox('uncheck');
}
});
}
function initRepository() {

+ 2
- 0
routers/install.go View File

@ -151,6 +151,7 @@ func Install(ctx *middleware.Context) {
form.OfflineMode = setting.OfflineMode
form.DisableGravatar = setting.DisableGravatar
form.DisableRegistration = setting.Service.DisableRegistration
form.EnableCaptcha = setting.Service.EnableCaptcha
form.RequireSignInView = setting.Service.RequireSignInView
auth.AssignForm(form, ctx.Data)
@ -301,6 +302,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
cfg.Section("server").Key("OFFLINE_MODE").SetValue(com.ToStr(form.OfflineMode))
cfg.Section("picture").Key("DISABLE_GRAVATAR").SetValue(com.ToStr(form.DisableGravatar))
cfg.Section("service").Key("DISABLE_REGISTRATION").SetValue(com.ToStr(form.DisableRegistration))
cfg.Section("service").Key("ENABLE_CAPTCHA").SetValue(com.ToStr(form.EnableCaptcha))
cfg.Section("service").Key("REQUIRE_SIGNIN_VIEW").SetValue(com.ToStr(form.RequireSignInView))
cfg.Section("").Key("RUN_MODE").SetValue("prod")

+ 7
- 1
templates/install.tmpl View File

@ -170,11 +170,17 @@
</div>
</div>
<div class="inline field">
<div class="ui checkbox">
<div class="ui checkbox" id="disable-registration">
<label class="poping up" data-content="{{.i18n.Tr "install.disable_registration_popup"}}"><strong>{{.i18n.Tr "install.disable_registration"}}</strong></label>
<input name="disable_registration" type="checkbox" {{if .disable_registration}}checked{{end}}>
</div>
</div>
<div class="inline field">
<div class="ui checkbox" id="enable-captcha">
<label class="poping up" data-content="{{.i18n.Tr "install.enable_captcha_popup"}}"><strong>{{.i18n.Tr "install.enable_captcha"}}</strong></label>
<input name="enable_captcha" type="checkbox" {{if .enable_captcha}}checked{{end}}>
</div>
</div>
<div class="inline field">
<div class="ui checkbox">
<label class="poping up" data-content="{{.i18n.Tr "install.require_sign_in_view_popup"}}"><strong>{{.i18n.Tr "install.require_sign_in_view"}}</strong></label>

Loading…
Cancel
Save