Permalink
Browse files

MDL-23692 forgotpw: Coding style tidyups.

  • Loading branch information...
1 parent 92de749 commit 2f0dd8d5bd8022c707099e8bdd2d7340073e128b @peterbulmer peterbulmer committed Aug 5, 2013
@@ -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',
View
@@ -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';
@@ -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';
View
@@ -2575,6 +2575,5 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2013092700.02);
}
-
return true;
}
@@ -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
@@ -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();
@@ -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);
}
@@ -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
@@ -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);
@@ -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;
View
@@ -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
Oops, something went wrong.

0 comments on commit 2f0dd8d

Please sign in to comment.