Add success message for login

This commit is contained in:
Jay Trees 2022-02-23 13:51:01 +01:00
parent 0dace7a404
commit 088c2f99cc
2 changed files with 16 additions and 2 deletions

View file

@ -37,6 +37,11 @@ class Page
$containerClasses[] = 'info icon'; $containerClasses[] = 'info icon';
$iconClasses[] = 'info circle'; $iconClasses[] = 'info circle';
break; break;
case 'success':
$containerClasses[] = 'success icon';
$iconClasses[] = 'check circle';
break;
} }
$containerClass = implode(' ', $containerClasses); $containerClass = implode(' ', $containerClasses);
@ -77,6 +82,11 @@ class Page
return self::message($content, $header, 'info'); return self::message($content, $header, 'info');
} }
public static function success(string $content, string $header = ''): string
{
return self::message($content, $header, 'success');
}
/** /**
* Non-Static * Non-Static
*/ */

View file

@ -32,8 +32,12 @@ $page->navigation();
<h1 class="ui header"><?= $page->title ?></h1> <h1 class="ui header"><?= $page->title ?></h1>
<?php <?php
if (isset($success) && !$success) { if (isset($success)) {
echo Page::error('User not found!', 'Error'); if ($success) {
echo Page::success('Successfully logged in as ' . $_SESSION['user']['email'] . '.', 'Success');
} else {
echo Page::error('User not found!', 'Error');
}
} }
?> ?>