Commit 1a83b282 authored by Nigel Cunningham's avatar Nigel Cunningham
Browse files

Fix form submission for no-reply email setting (Bug #946880)



After installation or upgrade, if the user clicks on a warning
about the no-reply email address and they also need to set up
required fields, the URL for the no-reply email address is
initially overridden by the required fields form. This patch
causes us to cleanly drop back out of the required fields form
code after the required fields form is successfully submitted,
letting the user then see the no-reply email address form.

This method of handling things will also work for any other
time the required fields form hijacks a URL - after the required
fields are set, the user will get the page they asked for.

Change-Id: I32aecaf898d02a572a5ab7b5c18bfaefc5607e41
Signed-off-by: default avatarNigel Cunningham <nigelc@catalyst-au.net>
parent 05efeba4
......@@ -931,10 +931,17 @@ function auth_check_required_fields() {
'name' => 'requiredfields',
'method' => 'post',
'action' => '',
'elements' => $elements
'elements' => $elements,
'dieaftersubmit' => FALSE,
'backoutaftersubmit' => TRUE,
));
}
// Has the form been successfully submitted? Back out and let the requested URL continue.
if ($form === FALSE) {
return;
}
$smarty = smarty();
if ($USER->get('parentuser')) {
$smarty->assign('loginasoverridepasswordchange',
......@@ -1103,6 +1110,10 @@ function requiredfields_submit(Pieform $form, $values) {
}
}
if ($form->get_property('backoutaftersubmit')) {
return;
}
redirect();
}
......
......@@ -160,7 +160,12 @@ class Pieform {/*{{{*/
*/
public static function process($data) {/*{{{*/
$form = new Pieform($data);
return $form->build();
if ($form->get_property('backingout')) {
return FALSE;
}
else {
return $form->build();
}
}/*}}}*/
/**
......@@ -536,6 +541,9 @@ class Pieform {/*{{{*/
}
else {
// Successful submission, and the user doesn't care about replying, so...
if (isset($this->data['backoutaftersubmit'])) {
$this->data['backingout'] = TRUE;
}
return;
}
}
......
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