prevent user creation with empty password

This commit is contained in:
Robin Appelman 2012-05-13 20:53:45 +02:00
parent 77e2387d94
commit 1a2ab2ef68
2 changed files with 10 additions and 1 deletions

View File

@ -123,6 +123,11 @@ class OC_User {
if(trim($uid) == ''){
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
if( self::userExists($uid) ){
throw new Exception('The username is already being used');

View File

@ -157,6 +157,7 @@ $(document).ready(function(){
$('#newuser').submit(function(event){
event.preventDefault();
var username=$('#newusername').val();
var password=$('#newuserpassword').val();
if($('#content table tbody tr').filterAttr('data-uid',username).length>0){
OC.dialogs.alert('The username is already being used', 'Error creating user');
return;
@ -165,7 +166,10 @@ $(document).ready(function(){
OC.dialogs.alert('A valid username must be provided', 'Error creating user');
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;
$('#newuser').get(0).reset();
$.post(