1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

Fixed #77 (Logins don't redirect...)

This commit is contained in:
Starbeamrainbowlabs 2016-06-04 20:27:14 +01:00
parent ff577f1ed8
commit 618fa54423
3 changed files with 54 additions and 32 deletions

View file

@ -4003,7 +4003,7 @@ function generate_page_list($pagelist)
register_module([
"name" => "Login",
"version" => "0.8.1",
"version" => "0.8.2",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a pair of actions (login and checklogin) that allow users to login. You need this one if you want your users to be able to login.",
"id" => "page-login",
@ -4011,12 +4011,11 @@ register_module([
global $settings;
/*
* _ _
* | | ___ __ _(_)_ __
* | |/ _ \ / _` | | '_ \
* | | (_) | (_| | | | | |
* |_|\___/ \__, |_|_| |_|
* |___/ %login%
* ██ ██████ ██████ ██ ███ ██
* ██ ██ ██ ██ ██ ████ ██
* ██ ██ ██ ██ ███ ██ ██ ██ ██
* ██ ██ ██ ██ ██ ██ ██ ██ ██
* ███████ ██████ ██████ ██ ██ ████
*/
add_action("login", function() {
global $settings;
@ -4044,13 +4043,19 @@ register_module([
exit(page_renderer::render_main($title, $content));
});
/*
* _ _ _ _
* ___| |__ ___ ___| | _| | ___ __ _(_)_ __
* / __| '_ \ / _ \/ __| |/ / |/ _ \ / _` | | '_ \
* | (__| | | | __/ (__| <| | (_) | (_| | | | | |
* \___|_| |_|\___|\___|_|\_\_|\___/ \__, |_|_| |_|
* %checklogin% |___/
* ██████ ██ ██ ███████ ██████ ██ ██
* ██ ██ ██ ██ ██ ██ ██
* ██ ███████ █████ ██ █████
* ██ ██ ██ ██ ██ ██ ██
* ██████ ██ ██ ███████ ██████ ██ ██
*
* ██ ██████ ██████ ██ ███ ██
* ██ ██ ██ ██ ██ ████ ██
* ██ ██ ██ ██ ███ ██ ██ ██ ██
* ██ ██ ██ ██ ██ ██ ██ ██ ██
* ███████ ██████ ██████ ██ ██ ████
*/
add_action("checklogin", function() {
global $settings, $env;
@ -4079,14 +4084,20 @@ register_module([
else
{
http_response_code(302);
header("location: index.php?action=login&failed=yes");
$nextUrl = "index.php?action=login&failed=yes";
if(!empty($_GET["returnto"]))
$nextUrl .= "&returnto=" . rawurlencode($_GET["returnto"]);
header("location: $nextUrl");
exit();
}
}
else
{
http_response_code(302);
header("location: index.php?action=login&failed=yes&badrequest=yes");
$nextUrl = "index.php?action=login&failed=yes&badrequest=yes";
if(!empty($_GET["returnto"]))
$nextUrl .= "&returnto=" . rawurlencode($_GET["returnto"]);
header("location: $nextUrl");
exit();
}
});

View file

@ -145,11 +145,11 @@
},
{
"name": "Login",
"version": "0.8.1",
"version": "0.8.2",
"author": "Starbeamrainbowlabs",
"description": "Adds a pair of actions (login and checklogin) that allow users to login. You need this one if you want your users to be able to login.",
"id": "page-login",
"lastupdate": 1460196125,
"lastupdate": 1465068396,
"optional": false
},
{

View file

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "Login",
"version" => "0.8.1",
"version" => "0.8.2",
"author" => "Starbeamrainbowlabs",
"description" => "Adds a pair of actions (login and checklogin) that allow users to login. You need this one if you want your users to be able to login.",
"id" => "page-login",
@ -9,12 +9,11 @@ register_module([
global $settings;
/*
* _ _
* | | ___ __ _(_)_ __
* | |/ _ \ / _` | | '_ \
* | | (_) | (_| | | | | |
* |_|\___/ \__, |_|_| |_|
* |___/ %login%
* ██ ██████ ██████ ██ ███ ██
* ██ ██ ██ ██ ██ ████ ██
* ██ ██ ██ ██ ███ ██ ██ ██ ██
* ██ ██ ██ ██ ██ ██ ██ ██ ██
* ███████ ██████ ██████ ██ ██ ████
*/
add_action("login", function() {
global $settings;
@ -42,13 +41,19 @@ register_module([
exit(page_renderer::render_main($title, $content));
});
/*
* _ _ _ _
* ___| |__ ___ ___| | _| | ___ __ _(_)_ __
* / __| '_ \ / _ \/ __| |/ / |/ _ \ / _` | | '_ \
* | (__| | | | __/ (__| <| | (_) | (_| | | | | |
* \___|_| |_|\___|\___|_|\_\_|\___/ \__, |_|_| |_|
* %checklogin% |___/
* ██████ ██ ██ ███████ ██████ ██ ██
* ██ ██ ██ ██ ██ ██ ██
* ██ ███████ █████ ██ █████
* ██ ██ ██ ██ ██ ██ ██
* ██████ ██ ██ ███████ ██████ ██ ██
*
* ██ ██████ ██████ ██ ███ ██
* ██ ██ ██ ██ ██ ████ ██
* ██ ██ ██ ██ ███ ██ ██ ██ ██
* ██ ██ ██ ██ ██ ██ ██ ██ ██
* ███████ ██████ ██████ ██ ██ ████
*/
add_action("checklogin", function() {
global $settings, $env;
@ -77,14 +82,20 @@ register_module([
else
{
http_response_code(302);
header("location: index.php?action=login&failed=yes");
$nextUrl = "index.php?action=login&failed=yes";
if(!empty($_GET["returnto"]))
$nextUrl .= "&returnto=" . rawurlencode($_GET["returnto"]);
header("location: $nextUrl");
exit();
}
}
else
{
http_response_code(302);
header("location: index.php?action=login&failed=yes&badrequest=yes");
$nextUrl = "index.php?action=login&failed=yes&badrequest=yes";
if(!empty($_GET["returnto"]))
$nextUrl .= "&returnto=" . rawurlencode($_GET["returnto"]);
header("location: $nextUrl");
exit();
}
});