From 79baaa37b67ef6273e9498d127e9bc2748393a10 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 23 Feb 2011 16:42:08 +0000 Subject: [PATCH] Make password optional for create account (it'll pick a random one if not specified) --- api.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api.php b/api.php index 2f8c4b5..53d56ae 100644 --- a/api.php +++ b/api.php @@ -255,18 +255,22 @@ switch($request[0]) { switch($request[1]) { /* APIDOC: account/create description(creates an account) - post(username varchar(64), password varchar(64), email varchar(64) optional) + post(username varchar(64), password varchar(64) optional, email varchar(64) optional) return(account array) */ case 'create': $user = trim($_POST['username']); $pass = trim($_POST['password']); $email = trim($_POST['email']); - if($user && $pass) { - $a=account_create($user,$pass); + if($user) { + if($pass) $p=$pass; else $p=NULL; + $a=account_create($user,$p); if(is_array($a)) { if($email) account_set_email($a['id'],$email); + else if(isEmailAddress($user)) + account_set_email($a['id'],$user); + $account=account_load($a['id']); $ret['status']="ok"; $ret['account']=$account;