beta4 changes (#26)
These changes are mostly in underlying libraries; however, this now uses the [inspired by F#](https://git.bitbadger.solutions/bit-badger/inspired-by-fsharp) library to handle the feed parsing pipeline and optional return values Reviewed-on: #26
This commit was merged in pull request #26.
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
<?php
|
||||
/**
|
||||
* User Log Off Page
|
||||
*
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
include '../../start.php';
|
||||
|
||||
if (key_exists(FeedReaderCentral\Key::USER_ID, $_SESSION)) session_destroy();
|
||||
if (key_exists(FeedReaderCentral\Key::UserId, $_SESSION)) session_destroy();
|
||||
|
||||
frc_redirect('/');
|
||||
|
||||
@@ -1,34 +1,39 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
<?php
|
||||
/**
|
||||
* User Log On Page
|
||||
*
|
||||
* Accepts the user's e-mail address (multi-user) and password (multi-user or single-user-with-password) and attempts
|
||||
* to log them on to Feed Reader Central
|
||||
*
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
include '../../start.php';
|
||||
|
||||
use BitBadger\InspiredByFSharp\Option;
|
||||
use FeedReaderCentral\{Key, Security};
|
||||
|
||||
Security::verifyUser(redirectIfAnonymous: false);
|
||||
|
||||
// Users already logged on have no need of this page
|
||||
if (key_exists(Key::USER_ID, $_SESSION)) frc_redirect('/');
|
||||
if (key_exists(Key::UserId, $_SESSION)) frc_redirect('/');
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
Security::logOnUser($_POST['email'] ?? '', $_POST['password'], $_POST['returnTo'] ?? null);
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
Security::logOnUser($_POST['email'] ?? '', $_POST['password'], Option::of($_POST['returnTo'] ?? null));
|
||||
// If we're still here, something didn't work; preserve the returnTo parameter
|
||||
$_GET['returnTo'] = $_POST['returnTo'];
|
||||
}
|
||||
|
||||
$isSingle = SECURITY_MODEL == Security::SINGLE_USER_WITH_PASSWORD;
|
||||
$isSingle = SECURITY_MODEL === Security::SingleUserPasswordMode;
|
||||
|
||||
page_head('Log On'); ?>
|
||||
<h1>Log On</h1>
|
||||
<article>
|
||||
<form method=POST action=/user/log-on><?php
|
||||
if (($_GET['returnTo'] ?? '') != '') { ?>
|
||||
if (($_GET['returnTo'] ?? '') !== '') { ?>
|
||||
<input type=hidden name=returnTo value="<?=$_GET['returnTo']?>"><?php
|
||||
}
|
||||
if (!$isSingle) { ?>
|
||||
|
||||
Reference in New Issue
Block a user