Commit f232792c authored by Nigel McNie's avatar Nigel McNie
Browse files

Make email/firstname/lastname optional for creating user accounts.

Also destroy the session when creating a new user, to prevent strange session-out-of-sync problems. I think they only happen when a crash happens while creating a user account but you can't be too careful.
parent 800e212e
......@@ -1123,6 +1123,7 @@ function login_submit(Pieform $form, $values) {
try {
// Reset the LiveUser object, since we are attempting to create a
// new user
$SESSION->destroy_session();
$USER = new LiveUser();
$authinstances = get_records_sql_array('
......
......@@ -1235,9 +1235,15 @@ function create_user($user, $profile=array(), $institution=null, $remoteauth=nul
// Bypass access check for 'copynewuser' institution/site views, because this user may not be logged in yet
$user->newuser = true;
set_profile_field($user->id, 'email', $user->email);
set_profile_field($user->id, 'firstname', $user->firstname);
set_profile_field($user->id, 'lastname', $user->lastname);
if (isset($user->email) && $user->email != '') {
set_profile_field($user->id, 'email', $user->email);
}
if (isset($user->firstname) && $user->firstname != '') {
set_profile_field($user->id, 'firstname', $user->firstname);
}
if (isset($user->lastname) && $user->lastname != '') {
set_profile_field($user->id, 'lastname', $user->lastname);
}
foreach ($profile as $k => $v) {
if (in_array($k, array('firstname', 'lastname', 'email'))) {
continue;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment