From 83e747bfda43c2c8fa0aceb2c989d42fe5ca1582 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 13 Sep 2015 11:07:21 -0400 Subject: #697 and #1606 and new admin edit user UI --- public/js/gogs.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'public/js') diff --git a/public/js/gogs.js b/public/js/gogs.js index 49011dbf2e..0b20592397 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -458,20 +458,26 @@ function initAdmin() { } // New user - if ($('.admin.new.user').length > 0) { + if ($('.admin.new.user').length > 0 || + $('.admin.edit.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(); + + if($(this).data('password')=="required"){ + $('#password').attr('required', 'required'); + } + } else { $('#login_name').attr('required', 'required'); - $('#password').removeAttr('required'); $('.non-local').show(); $('.local').hide(); $('#login_name').focus(); + + $('#password').removeAttr('required'); } }); } -- cgit v1.2.3