Commit a3978dcd authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review
Browse files

Merge "Bug 1770261: remove extra submit field in login form"

parents 3eec9dc0 52661cb3
......@@ -15,7 +15,7 @@ define('NOCHECKREQUIREDFIELDS', 1);
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
require_once('activity.php');
if (param_integer('login_submitted', 0)) {
if (isset($_POST['pieform_login'])) {
redirect(get_config('wwwroot'));
}
......
......@@ -1373,11 +1373,6 @@ function auth_draw_login_page($message=null, Pieform $form=null) {
function auth_get_login_form() {
$elements = auth_get_login_form_elements();
$elements['login']['elements']['login_submitted'] = array(
'type' => 'hidden',
'value' => 1
);
// Change login redirection for clean urls
$url = get_relative_script_path();
$getstart = strrpos($url, '?');
......@@ -1670,7 +1665,7 @@ class AuthFactory {
* @param array $values The submitted values
*/
function login_validate(Pieform $form, $values) {
if (!empty($values['login_submitted'])) {
if (isset($values['pieform_login'])) { // only set by $form->build()
if (empty($values['login_username']) || empty($values['login_password'])) {
$form->set_error(null, get_string('loginfailed'));
}
......
......@@ -590,8 +590,8 @@ class Pieform {/*{{{*/
}
else {
global $SESSION;
// The login system comes past here twice so we need to pace first error message above form
if (!empty($values['login_submitted'])) {
// The login system comes past here twice so we need to paste first error message above form
if (isset($values['pieform_login'])) {
$SESSION->add_error_msg($this->get_property('errormessage'), false, 'loginbox');
}
else {
......
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