diff options
author | Unknwon <u@gogs.io> | 2015-09-13 09:51:51 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-13 09:51:51 -0400 |
commit | 8e0a69f86a9e103d1d82d3c5000e01b4e2570a51 (patch) | |
tree | 6c0802f63be1ff7867b80375b406dd8b520f6b1e /public/js | |
parent | e2d6b0116e44ca0fa2c577f40adde4ebfa612ae0 (diff) | |
download | gitea-8e0a69f86a9e103d1d82d3c5000e01b4e2570a51.tar.gz gitea-8e0a69f86a9e103d1d82d3c5000e01b4e2570a51.zip |
#697 disable captcha and new admin create user UI
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/gogs.js | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index e9e9ba5b95..49011dbf2e 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -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; } |