Commit c4609cc5 authored by Nigel McNie's avatar Nigel McNie Committed by Nigel McNie
Browse files

Fixed registration - make sure that email validation is against all e-mail

addresses, not just primary ones. Make sure that newly registered users
do not clobber existing e-mail addresses.
parent 165fabc6
......@@ -169,7 +169,7 @@ function set_profile_field($userid, $field, $value) {
// specified one
if ($field == 'email') {
try {
$email = artefact_instance_from_type('email');
$email = artefact_instance_from_type('email', $userid);
}
catch (ArtefactNotFoundException $e) {
$email = new ArtefactTypeEmail();
......
......@@ -372,7 +372,7 @@ function register_validate(Pieform $form, $values) {
// The e-mail address cannot already be in the system
if (!$form->get_error('email')
&& (record_exists('usr', 'email', $values['email'])
|| record_exists('usr_registration', 'email', $values['email']))) {
|| record_exists('artefact_internal_profile_email', 'email', $values['email']))) {
$form->set_error('email', get_string('emailalreadytaken', 'auth.internal'));
}
......@@ -403,6 +403,7 @@ function register_submit(Pieform $form, $values) {
insert_record('usr_registration', $values);
$user =(object) $values;
$user->admin = 0;
email_user($user, null,
get_string('registeredemailsubject', 'auth.internal', get_config('sitename')),
get_string('registeredemailmessagetext', 'auth.internal', $values['firstname'], get_config('sitename'), $values['key'], get_config('sitename')),
......
Supports Markdown
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