Refactor /signup to /login to be more clear

(Actually the signup and login process is the same)
This commit is contained in:
Bofh 2021-11-27 02:18:09 +01:00
parent a2f03869d1
commit 418d4f3371
6 changed files with 13 additions and 13 deletions

View File

@ -9,7 +9,7 @@ if ($instance === false) {
$app_name = conf('app_name', 'RealFan'); $app_name = conf('app_name', 'RealFan');
$site_name = conf('site_name', HOST_DEV); $site_name = conf('site_name', HOST_DEV);
$redirect_uris = conf('site_name', HOST_DEV).'/signup/mastodon:oauth'; $redirect_uris = conf('site_name', HOST_DEV).'/login/mastodon:oauth';
$scopes = 'read:accounts write'; $scopes = 'read:accounts write';
# create the Authorization App # create the Authorization App

View File

@ -20,7 +20,7 @@ $p = [
<div class="row"> <div class="row">
<div class="one-half column"> <div class="one-half column">
<h4 class="hero-heading"><?php l('home.hero', 'You are a <b>Real Fan</b> when you want your content creators to get the highest cut.') ?></h4> <h4 class="hero-heading"><?php l('home.hero', 'You are a <b>Real Fan</b> when you want your content creators to get the highest cut.') ?></h4>
<a class="button button-primary" href="/signup"><?php l('home.register', 'Sign up') ?></a> <a class="button button-primary" href="/login"><?php l('home.register', 'Sign up') ?></a>
</div> </div>
<div class="one-half column phones"> <div class="one-half column phones">
<img class="phone" src="https://getskeleton.com/examples/landing/images/iphone.png"> <img class="phone" src="https://getskeleton.com/examples/landing/images/iphone.png">

View File

@ -2,7 +2,7 @@
<?php <?php
$function = null; $function = null;
$signup_method = null; $login_method = null;
if (isset($_SERVER['REDIRECT_URL'])) { if (isset($_SERVER['REDIRECT_URL'])) {
# process URI # process URI
@ -14,18 +14,18 @@ if (isset($_SERVER['REDIRECT_URL'])) {
die('Unexpected error'); die('Unexpected error');
} }
# get the signup method from URL # get the login method from URL
if (str_contains($args[1], ':')) { if (str_contains($args[1], ':')) {
$ps = explode(':', $args[1]); $ps = explode(':', $args[1]);
$signup_method = $ps[0]; $login_method = $ps[0];
$function = $ps[1]; $function = $ps[1];
} else { } else {
$signup_method = $args[1]; $login_method = $args[1];
$function = 'view'; $function = 'view';
} }
if (!in_array($signup_method, ['mastodon'])) { if (!in_array($login_method, ['mastodon'])) {
die('The given signup method does not exist'); die('The given login method does not exist');
} }
if (!in_array($function, ['view', 'oauth'])) { if (!in_array($function, ['view', 'oauth'])) {
@ -40,10 +40,10 @@ if ($function === 'oauth') {
$ID = $_GET['id'] ?? ''; $ID = $_GET['id'] ?? '';
$code = $_GET['code'] ?? ''; $code = $_GET['code'] ?? '';
if (empty($code) || empty($ID)) { if (empty($code) || empty($ID)) {
header('Location: /signup'); die; header('Location: /login'); die;
} }
switch ($signup_method) { switch ($login_method) {
case 'mastodon': case 'mastodon':
require '/src/action/oauth/mastodon.php'; require '/src/action/oauth/mastodon.php';
break; break;
@ -55,7 +55,7 @@ if ($function === 'oauth') {
<?php require '/src/views/public/head.php' ?> <?php require '/src/views/public/head.php' ?>
<main> <main>
SIGNUP: <?php echo $signup_method ?> LOGIN: <?php echo $login_method ?>
<br> <br>
FUNCTION: <?php echo $function ?> FUNCTION: <?php echo $function ?>
</main> </main>

View File

@ -3,7 +3,7 @@
$payload_fil = '/tmp/oauth-'.$ID; $payload_fil = '/tmp/oauth-'.$ID;
if (!file_exists($payload_fil)) { if (!file_exists($payload_fil)) {
header('Location: /signup'); die; header('Location: /login'); die;
} }
# get mastodon auth token # get mastodon auth token

View File

@ -20,7 +20,7 @@ const http = {
const API = { const API = {
mastodon: { mastodon: {
registerInstance: function(instance) { registerInstance: function(instance) {
http.get('/api/signup/mastodon/get_client.php?instance='+encodeURIComponent(instance), {}, function(data) http.get('/api/login/mastodon/get_client.php?instance='+encodeURIComponent(instance), {}, function(data)
{ {
data = JSON.parse(data); data = JSON.parse(data);
if (data.status === 'err') { if (data.status === 'err') {