[Pkg-owncloud-commits] [owncloud] 106/394: Better check and handling of user creation
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:11:38 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 3ed0960edb53ddcc320b7858d964138d98bb7c60
Author: Bart Visscher <bartv at thisnet.nl>
Date: Wed Nov 14 21:44:44 2012 +0100
Better check and handling of user creation
---
lib/user.php | 2 +-
settings/ajax/createuser.php | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/user.php b/lib/user.php
index 63b10b5..df098d7 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -182,7 +182,7 @@ class OC_User {
$backend->createUser($uid,$password);
OC_Hook::emit( "OC_User", "post_createUser", array( "uid" => $uid, "password" => $password ));
- return true;
+ return self::userExists($uid);
}
}
return false;
diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php
index bdf7e49..eecc266 100644
--- a/settings/ajax/createuser.php
+++ b/settings/ajax/createuser.php
@@ -37,14 +37,17 @@ $username = $_POST["username"];
$password = $_POST["password"];
// Does the group exist?
-if( in_array( $username, OC_User::getUsers())) {
+if(OC_User::userExists($username)) {
OC_JSON::error(array("data" => array( "message" => "User already exists" )));
exit();
}
// Return Success story
try {
- OC_User::createUser($username, $password);
+ if (!OC_User::createUser($username, $password)) {
+ OC_JSON::error(array('data' => array( 'message' => 'User creation failed for '.$username )));
+ exit();
+ }
foreach( $groups as $i ) {
if(!OC_Group::groupExists($i)) {
OC_Group::createGroup($i);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list