Skip to content

Commit

Permalink
MDL-23692 forgotpw: Coding style tidyups.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbulmer committed Oct 7, 2013
1 parent 92de749 commit 2f0dd8d
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 119 deletions.
14 changes: 7 additions & 7 deletions admin/settings/security.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', new lang_string('minpasswordnonalphanum', 'admin'), new lang_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('maxconsecutiveidentchars', new lang_string('maxconsecutiveidentchars', 'admin'), new lang_string('configmaxconsecutiveidentchars', 'admin'), 0, PARAM_INT));
$pwresetoptions = array(
300 => new lang_string('numminutes', '', 5),
900 => new lang_string('numminutes', '', 15),
1800 => new lang_string('numminutes', '', 30),
2700 => new lang_string('numminutes', '', 45),
3600 => new lang_string('numminutes', '', 60),
7200 => new lang_string('numminutes', '', 120),
14400 => new lang_string('numminutes', '', 240)
300 => new lang_string('numminutes', '', 5),
900 => new lang_string('numminutes', '', 15),
1800 => new lang_string('numminutes', '', 30),
2700 => new lang_string('numminutes', '', 45),
3600 => new lang_string('numminutes', '', 60),
7200 => new lang_string('numminutes', '', 120),
14400 => new lang_string('numminutes', '', 240)
);
$adminsetting = new admin_setting_configselect(
'pwresettime',
Expand Down
6 changes: 3 additions & 3 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
$string['editthiscategory'] = 'Edit this category';
$string['edituser'] = 'Edit user accounts';
$string['email'] = 'Email address';
$string['emailalreadysent'] = 'A Password reset email has already been sent. Please check your email.';
$string['emailalreadysent'] = 'A password reset email has already been sent. Please check your email.';
$string['emailactive'] = 'Email activated';
$string['emailagain'] = 'Email (again)';
$string['emailconfirm'] = 'Confirm your account';
Expand Down Expand Up @@ -1564,8 +1564,8 @@
$string['servererror'] = 'An error occurred whilst communicating with the server';
$string['serverlocaltime'] = 'Server\'s local time';
$string['setcategorytheme'] = 'Set category theme';
$string['setpassword'] = 'Set Password';
$string['setpasswordinstructions'] = 'Please enter and repeat your new password below, then click "Set Password". <br />Your new password will be saved, and you will be logged in.';
$string['setpassword'] = 'Set password';
$string['setpasswordinstructions'] = 'Please enter and repeat your new password below, then click "Set password". <br />Your new password will be saved, and you will be logged in.';
$string['settings'] = 'Settings';
$string['shortname'] = 'Short name'; // @deprecated MDL-34652 - use shortnamecourse or shortnameuser or some own context specific string
$string['shortnamecollisionwarning'] = '[*] = This shortname is already in use by a course and will need to be changed upon approval';
Expand Down
1 change: 0 additions & 1 deletion lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2575,6 +2575,5 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2013092700.02);
}


return true;
}
9 changes: 4 additions & 5 deletions login/forgot_password.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -32,7 +31,7 @@
require_once('forgot_password_form.php');
require_once('set_password_form.php');

$token = optional_param('token', false, PARAM_RAW);
$token = optional_param('token', false, PARAM_ALPHANUM);

//HTTPS is required in this page when $CFG->loginhttps enabled
$PAGE->https_required();
Expand Down Expand Up @@ -62,10 +61,10 @@

if (empty($token)) {
// This is a new password reset request.
// Process the request; identify the user & send confirmation email:
forgotpw_process_request();
// Process the request; identify the user & send confirmation email.
core_login_process_password_reset_request();
} else {
// User clicked on confirmation link in email message
// validate the token & set new password
forgotpw_process_pwset($token);
core_login_process_password_set($token);
}
25 changes: 20 additions & 5 deletions login/forgot_password_form.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
Expand All @@ -16,20 +15,30 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Reset forgotten password form definition.
* Forgot password page.
*
* @package core
* @subpackage auth
* @copyright 2006 Petr Skoda {@link http://skodak.org}
* @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

require_once $CFG->libdir.'/formslib.php';
require_once($CFG->libdir.'/formslib.php');

/**
* Reset forgotten password form definition.
*
* @package core
* @subpackage auth
* @copyright 2006 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class login_forgot_password_form extends moodleform {

/**
* Define the forgot password form.
*/
function definition() {
$mform = $this->_form;
$mform->setDisableShortforms(true);
Expand All @@ -51,6 +60,12 @@ function definition() {
$mform->addElement('submit', 'submitbuttonemail', $submitlabel);
}

/**
* Validate user input from the forgot password form.
* @param array $data array of submitted form fields.
* @param array $files submitted with the form.
* @return array errors occuring during validation.
*/
function validation($data, $files) {
global $CFG, $DB;

Expand Down
2 changes: 1 addition & 1 deletion login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
set_moodle_cookie($USER->username);
}

$urltogo = get_postlogin_redirection();
$urltogo = core_login_get_return_url();

/// check if user password has expired
/// Currently supported only for ldap-authentication module
Expand Down
Loading

0 comments on commit 2f0dd8d

Please sign in to comment.