Commit 6395a5d5 authored by Gordian Edenhofer's avatar Gordian Edenhofer Committed by Lukas Fleischer
Browse files

Redirect at previous page after a successful login



After the user was authenticated a redirect to the site which
linked the user to the login page is done. This fixes FS#32481.

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent d841357d
......@@ -42,6 +42,11 @@ html_header('AUR ' . __("Login"));
<p>
<input type="submit" class="button" value="<?php print __("Login"); ?>" />
<a href="<?= get_uri('/passreset/') ?>">[<?= __('Forgot Password') ?>]</a>
<?php if (in_request('referer') !== ""): ?>
<input id="id_referer" type="hidden" name="referer" value="<?= in_request('referer') ?>" />
<?php elseif (isset($_SERVER['HTTP_REFERER'])): ?>
<input id="id_referer" type="hidden" name="referer" value="<?= htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES) ?>" />
<?php endif; ?>
</p>
</fieldset>
</form>
......
......@@ -544,7 +544,12 @@ function try_login() {
}
setcookie("AURSID", $new_sid, $cookie_time, "/", null, !empty($_SERVER['HTTPS']), true);
header("Location: " . get_uri('/'));
$referer = in_request('referer');
if (strpos($referer, aur_location()) !== 0) {
$referer = '/';
}
header("Location: " . get_uri($referer));
$login_error = "";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment