MDL-61261 badges: Add email validation during backpack configuration

This commit is contained in:
Sara Arjona 2018-01-24 11:56:32 +01:00
parent a409707794
commit 8d7c385203

View File

@ -61,10 +61,10 @@ class edit_backpack_form extends moodleform {
array('class' => 'notconnected', 'id' => 'connection-status'));
$mform->addElement('static', 'status', get_string('status'), $status);
$mform->addElement('hidden', 'email', $this->_customdata['email']);
$mform->setType('email', PARAM_RAW_TRIMMED);
$mform->setType('email', PARAM_EMAIL);
$mform->hardFreeze(['email']);
$status = html_writer::tag('span', $this->_customdata['email'], []);
$mform->addElement('static', 'emailverify', get_string('email'), $status);
$emailverify = html_writer::tag('span', s($this->_customdata['email']), []);
$mform->addElement('static', 'emailverify', get_string('email'), $emailverify);
$buttonarray = [];
$buttonarray[] = &$mform->createElement('submit', 'submitbutton',
get_string('backpackconnectionresendemail', 'badges'));
@ -80,7 +80,7 @@ class edit_backpack_form extends moodleform {
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
$mform->addHelpButton('email', 'backpackemail', 'badges');
$mform->addRule('email', get_string('required'), 'required', null, 'client');
$mform->setType('email', PARAM_RAW_TRIMMED);
$mform->setType('email', PARAM_EMAIL);
$this->add_action_buttons(false, get_string('backpackconnectionconnect', 'badges'));
}
}