forked from science-ation/science-ation
Make password optional for create account (it'll pick a random one if not specified)
This commit is contained in:
parent
a484939f1b
commit
79baaa37b6
10
api.php
10
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;
|
||||
|
Loading…
Reference in New Issue
Block a user