prevent user creation with empty password
This commit is contained in:
parent
77e2387d94
commit
1a2ab2ef68
2 changed files with 10 additions and 1 deletions
|
@ -123,6 +123,11 @@ class OC_User {
|
||||||
if(trim($uid) == ''){
|
if(trim($uid) == ''){
|
||||||
throw new Exception('A valid username must be provided');
|
throw new Exception('A valid username must be provided');
|
||||||
}
|
}
|
||||||
|
// No empty password
|
||||||
|
if(trim($password) == ''){
|
||||||
|
throw new Exception('A valid password must be provided');
|
||||||
|
}
|
||||||
|
|
||||||
// Check if user already exists
|
// Check if user already exists
|
||||||
if( self::userExists($uid) ){
|
if( self::userExists($uid) ){
|
||||||
throw new Exception('The username is already being used');
|
throw new Exception('The username is already being used');
|
||||||
|
|
|
@ -157,6 +157,7 @@ $(document).ready(function(){
|
||||||
$('#newuser').submit(function(event){
|
$('#newuser').submit(function(event){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var username=$('#newusername').val();
|
var username=$('#newusername').val();
|
||||||
|
var password=$('#newuserpassword').val();
|
||||||
if($('#content table tbody tr').filterAttr('data-uid',username).length>0){
|
if($('#content table tbody tr').filterAttr('data-uid',username).length>0){
|
||||||
OC.dialogs.alert('The username is already being used', 'Error creating user');
|
OC.dialogs.alert('The username is already being used', 'Error creating user');
|
||||||
return;
|
return;
|
||||||
|
@ -165,7 +166,10 @@ $(document).ready(function(){
|
||||||
OC.dialogs.alert('A valid username must be provided', 'Error creating user');
|
OC.dialogs.alert('A valid username must be provided', 'Error creating user');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var password=$('#newuserpassword').val();
|
if($.trim(password) == '') {
|
||||||
|
OC.dialogs.alert('A valid password must be provided', 'Error creating user');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
var groups=$('#newusergroups').prev().children('div').data('settings').checked;
|
var groups=$('#newusergroups').prev().children('div').data('settings').checked;
|
||||||
$('#newuser').get(0).reset();
|
$('#newuser').get(0).reset();
|
||||||
$.post(
|
$.post(
|
||||||
|
|
Loading…
Reference in a new issue