diff options
Diffstat (limited to 'settings/js/users/users.js')
-rw-r--r-- | settings/js/users/users.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js index d910e1ec129..e0eb5ff1601 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -695,6 +695,7 @@ $(document).ready(function () { event.preventDefault(); var username = $('#newusername').val(); var password = $('#newuserpassword').val(); + var email = $('#newemail').val(); if ($.trim(username) === '') { OC.dialogs.alert( t('settings', 'A valid username must be provided'), @@ -707,14 +708,24 @@ $(document).ready(function () { t('settings', 'Error creating user')); return false; } - var groups = $('#newusergroups').val(); + if(!$('#CheckboxMailOnUserCreate').is(':checked')) { + email = ''; + } + if ($('#CheckboxMailOnUserCreate').is(':checked') && $.trim(email) === '') { + OC.dialogs.alert( + t('settings', 'A valid email must be provided'), + t('settings', 'Error creating user')); + return false; + } + var groups = $('#newusergroups').val() || []; $('#newuser').get(0).reset(); $.post( OC.generateUrl('/settings/users/users'), { username: username, password: password, - groups: groups + groups: groups, + email: email }, function (result) { if (result.groups) { @@ -774,6 +785,14 @@ $(document).ready(function () { $("#userlist .userBackend").hide(); } }); + // Option to display/hide the "E-Mail" input field + $('#CheckboxMailOnUserCreate').click(function() { + if ($('#CheckboxMailOnUserCreate').is(':checked')) { + $("#newemail").show(); + } else { + $("#newemail").hide(); + } + }); // calculate initial limit of users to load var initialUserCountLimit = 20, |