Commit 0653aa29 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1761037: Commit the email update on first install correctly



Rather than update db directly - we need to update the USER object

behatnotneeded

Change-Id: I31f8c6759dd621439c90ddc0f0dc8a344359d5d9
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 4adf4a01)
(cherry picked from commit 6905c539)
parent 49a9e1f8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1060,9 +1060,10 @@ function requiredfields_submit(Pieform $form, $values) {
                $oldemail = get_field('usr', 'email', 'id', $USER->get('id'));
                if ($oldemail == 'admin@example.org') {
                    // we are dealing with the dummy email that is set on install
                    update_record('usr', array('email' => $email), array('id' => $USER->get('id')));
                    update_record('artefact_internal_profile_email', array('email' => $email), array('owner' => $USER->get('id')));
                    update_record('artefact', array('title' => $email), array('owner' => $USER->get('id'), 'artefacttype' => 'email'));
                    $USER->email = $email;
                    $USER->commit();
                }
            }
            // Check if a validation email has been sent, if not send one