Browse Source

Add redirect parameters to signup link

master
Skylar Ittner 2 years ago
parent
commit
ac1ad47aba
  1. 2
      login/parts/username.php
  2. 6
      signup/index.php

2
login/parts/username.php

@ -25,7 +25,7 @@ $_SESSION['check'] = "username";
<?php
if ($SETTINGS['signups_enabled'] === true) {
?>
<a href="../signup/" class="btn btn-link mr-2"><?php $Strings->get("Create Account"); ?></a>
<a href="../signup/?code=<?php echo urlencode($_GET["code"]); ?>&amp;redirect=<?php echo urlencode($_GET["redirect"]); ?>" class="btn btn-link mr-2"><?php $Strings->get("Create Account"); ?></a>
<?php
}
?>

6
signup/index.php

@ -21,6 +21,8 @@ function showHTML($errormsg = null, $genform = true, $noformcontent = "", $title
$form->addInput("password", "", "password", true, null, null, "Password", "fas fa-lock", 6, $SETTINGS['min_password_length'], 255, "", $Strings->build("Your password must be at least {n} characters long.", ["n" => $SETTINGS['min_password_length']], false));
$form->addInput("email", "", "email", false, null, null, "Email", "fas fa-envelope", 6, 5, 255, "", $Strings->get("That email address doesn't look right.", false));
$form->addInput("name", "", "text", true, null, null, "Name", "fas fa-user", 6, 2, 200, "", $Strings->get("Enter your name.", false));
$form->addHiddenInput("code", $_GET["code"]);
$form->addHiddenInput("redirect", $_GET["redirect"]);
if (!empty($SETTINGS['tos_url'])) {
$form->addInput("agree_tos", "1", "checkbox", true, null, null, "I agree to the <a href=\"$SETTINGS[tos_url]\" target=\"_BLANK\">terms of service</a>");
@ -153,10 +155,12 @@ if (empty($_POST['name'])) {
$userid = User::add($_POST['username'], $_POST['password'], $_POST['name'], (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) ? $_POST['email'] : null));
$signinstr = $Strings->get("sign in", false);
$redirect = urlencode($_POST["redirect"]);
$code = urlencode($_POST["code"]);
showHTML(null, false, <<<END
<div class="card mt-4">
<div class="card-body">
<a href="../" class="btn btn-primary btn-block">$signinstr</a>
<a href="../login/?code=$code&amp;redirect=$redirect" class="btn btn-primary btn-block">$signinstr</a>
</div>
</div>
END

Loading…
Cancel
Save