Refactor /signup to /login to be more clear

(Actually the signup and login process is the same)
master
Bofh 1 year ago
parent a2f03869d1
commit 418d4f3371

@ -9,7 +9,7 @@ if ($instance === false) {
$app_name = conf('app_name', 'RealFan');
$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';
# create the Authorization App

@ -20,7 +20,7 @@ $p = [
<div class="row">
<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>
<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 class="one-half column phones">
<img class="phone" src="https://getskeleton.com/examples/landing/images/iphone.png">

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

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

@ -20,7 +20,7 @@ const http = {
const API = {
mastodon: {
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);
if (data.status === 'err') {

Loading…
Cancel
Save