Esempio n. 1
1
$add->gender = $user['gender'];
$add->birthdate = $user['birthdate'];
$add->usertype = $user['type'];
if (!$add->isUsername($user['username'])) {
    ossn_trigger_message(ossn_print('username:error'), 'error');
    redirect(REF);
}
if (!$add->isPassword()) {
    ossn_trigger_message(ossn_print('password:error'), 'error');
    redirect(REF);
}
if ($add->isOssnUsername()) {
    ossn_trigger_message(ossn_print('username:inuse'), 'error');
    redirect(REF);
}
if ($add->isOssnEmail()) {
    ossn_trigger_message(ossn_print('email:inuse'), 'error');
    redirect(REF);
}
//check if email is valid email
if (!$add->isEmail()) {
    ossn_trigger_message(ossn_print('email:invalid'), 'error');
    redirect(REF);
}
if ($add->addUser()) {
    ossn_trigger_message(ossn_print('account:created'), 'success');
    redirect(REF);
} else {
    ossn_trigger_message(ossn_print('account:create:error:admin'), 'error');
    redirect(REF);
}
Esempio n. 2
0
$OssnUser->password = $password;
$OssnUser->email = $user['email'];
$OssnDatabase = new OssnDatabase();
$params['table'] = 'ossn_users';
$params['wheres'] = array("guid='{$entity->guid}'");
$params['names'] = array('first_name', 'last_name', 'email', 'type');
$params['values'] = array($user['firstname'], $user['lastname'], $user['email'], $user['type']);
//check if email is not in user
if ($entity->email !== input('email')) {
    if ($OssnUser->isOssnEmail()) {
        ossn_trigger_message(ossn_print('email:inuse'), 'error');
        redirect(REF);
    }
}
//check if email is valid email
if (!$OssnUser->isEmail()) {
    ossn_trigger_message(ossn_print('email:invalid'), 'error');
    redirect(REF);
}
//check if password then change password
if (!empty($password)) {
    if (!$OssnUser->isPassword()) {
        ossn_trigger_message(ossn_print('password:error'), 'error');
        redirect(REF);
    }
    $salt = $OssnUser->generateSalt();
    $password = $OssnUser->generate_password($password, $salt);
    $params['names'] = array('first_name', 'last_name', 'email', 'type', 'password', 'salt');
    $params['values'] = array($user['firstname'], $user['lastname'], $user['email'], $user['type'], $password, $salt);
}
//save