If the user needs to set up their account on logging in, then remember the

URL they wanted so they get there after setting up their account.


bug 2565
This commit is contained in:
moodler
2005-02-17 06:15:22 +00:00
parent 1ab853e586
commit 20fde7b1f9
3 changed files with 11 additions and 4 deletions
+4 -4
View File
@@ -1054,13 +1054,14 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
$wwwroot = str_replace('http','https', $CFG->wwwroot);
redirect($wwwroot .'/login/index.php'. $loginguest);
}
die;
exit;
}
// check whether the user should be changing password
// reload_user_preferences(); // Why is this necessary? Seems wasteful. - MD
if (!empty($USER->preference['auth_forcepasswordchange'])){
if (is_internal_auth() || $CFG->{'auth_'.$USER->auth.'_stdchangepassword'}){
$SESSION->wantsurl = $FULLME;
redirect($CFG->wwwroot .'/login/change_password.php');
} elseif($CFG->changepassword) {
redirect($CFG->changepassword);
@@ -1072,8 +1073,8 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
}
// Check that the user account is properly set up
if (user_not_fully_set_up($USER)) {
$SESSION->wantsurl = $FULLME;
redirect($CFG->wwwroot .'/user/edit.php?id='. $USER->id .'&course='. SITEID);
die;
}
// Make sure current IP matches the one for this session (if required)
@@ -1091,7 +1092,6 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
if (!$USER->policyagreed) {
$SESSION->wantsurl = $FULLME;
redirect($CFG->wwwroot .'/user/policy.php');
die;
}
}
@@ -1099,7 +1099,7 @@ function require_login($courseid=0, $autologinguest=true, $cm=null) {
if (!isadmin()) {
if (file_exists($CFG->dataroot.'/1/maintenance.html')) {
print_maintenance_message();
die;
exit;
}
}
+1
View File
@@ -143,6 +143,7 @@
add_to_log(SITEID, "user", "login", "view.php?id=$user->id&course=".SITEID, $user->id, 0, $user->id);
if (user_not_fully_set_up($USER)) {
$SESSION->wantsurl = $wantsurl; /// Postpone this redirect a while longer!
$urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&course='.SITEID;
} else if (strpos($wantsurl, $CFG->wwwroot) === 0) { /// Matches site address
+6
View File
@@ -10,6 +10,12 @@
optional_variable($enable, "");
optional_variable($disable, "");
if (!empty($SESSION->wantsurl)) {
$wantsurl = $SESSION->wantsurl;
unset($SESSION->wantsurl);
redirect($wantsurl);
}
if (empty($id)) { // See your own profile by default
require_login();
$id = $USER->id;