login: only allow relative URLs in return=
This commit is contained in:
parent
cc57ed3775
commit
c68ac04020
|
@ -712,8 +712,10 @@ class Handler_Public extends Handler {
|
||||||
user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
|
user_error("Failed login attempt for $login from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clean($_REQUEST['return'])) {
|
$return = clean($_REQUEST['return']);
|
||||||
header("Location: " . clean($_REQUEST['return']));
|
|
||||||
|
if ($return && !is_absolute_url($return)) {
|
||||||
|
header("Location: " . $return);
|
||||||
} else {
|
} else {
|
||||||
header("Location: " . get_self_url_prefix());
|
header("Location: " . get_self_url_prefix());
|
||||||
}
|
}
|
||||||
|
|
|
@ -2562,3 +2562,9 @@
|
||||||
|
|
||||||
return $ts;
|
return $ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_absolute_url($url) {
|
||||||
|
$parts = parse_url($url);
|
||||||
|
|
||||||
|
return $parts['host'] != '';
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue