Add success page.
This commit is contained in:
parent
e2a3c95f99
commit
f3f36b333c
@ -24,6 +24,13 @@ class Bootstrap
|
||||
|
||||
// set all configuration details
|
||||
|
||||
$config->merge([
|
||||
'site' => [
|
||||
'name' => "Slovocast",
|
||||
'description' => "A no-bullshit podcast hosting platform."
|
||||
],
|
||||
]);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
@ -39,8 +46,9 @@ class Bootstrap
|
||||
|
||||
$config = self::initConfig();
|
||||
$containerBuilder->addDefinitions([
|
||||
'conifg' => $config,
|
||||
'config' => $config,
|
||||
// more DI stuff
|
||||
|
||||
]);
|
||||
|
||||
return $containerBuilder->build();
|
||||
@ -66,6 +74,10 @@ class Bootstrap
|
||||
*/
|
||||
protected static function establishMiddleware(App $app): void
|
||||
{
|
||||
/**
|
||||
* @var Configuration
|
||||
*/
|
||||
$config = $app->get('config');
|
||||
$app->addErrorMiddleware(true, true, true);
|
||||
|
||||
// Twig
|
||||
@ -73,8 +85,10 @@ class Bootstrap
|
||||
$templateCache = false;
|
||||
$twig = Twig::create($templatePath, [ 'cache' => $templateCache ]);
|
||||
// Add the global variables
|
||||
$twig->getEnvironment()->addGlobal('site_name', "Slovocast");
|
||||
$twig->getEnvironment()->addGlobal('site_description', "A no-bullshit podcast hosting service");
|
||||
$twig->getEnvironment()
|
||||
->addGlobal('site_name', $config->get('site.name'));
|
||||
$twig->getEnvironment()
|
||||
->addGlobal('site_description', $config->get('site.description'));
|
||||
$app->add(TwigMiddleware::create($app, $twig));
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,8 @@ class RegisterUserAction extends Controller
|
||||
{
|
||||
public function respond(): Response
|
||||
{
|
||||
return $this->respond('users/register/success.twig');
|
||||
// get user Data
|
||||
|
||||
return $this->render('user/success.twig');
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +93,34 @@ class UserRepository implements UserRepositoryInterface
|
||||
|
||||
public function update(User $user): bool
|
||||
{
|
||||
$connection = $this->database->getConnection();
|
||||
$query = "UPDATE users
|
||||
SET email = :email,
|
||||
name = :name,
|
||||
password = :password
|
||||
WHERE id = :id";
|
||||
|
||||
$statement = $connection->prepare($query);
|
||||
return $statement->execute([
|
||||
'email' => $user->getEmail(),
|
||||
'name' => $user->getName(),
|
||||
'password' => $this->userAuth->hash($user->getPassword()),
|
||||
'id' => $user->getId()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $email
|
||||
* @param string $password
|
||||
* @return bool
|
||||
*/
|
||||
public function verifyPassword(string $email, string $password): bool
|
||||
{
|
||||
try {
|
||||
$user = $this->getFromEmail($email);
|
||||
return $this->authUser->verify($password, $user->getPassword());
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,5 @@ interface UserRepositoryInterface
|
||||
public function getFromEmail(string $email): User;
|
||||
public function save(User $user): bool;
|
||||
public function update(User $user): bool;
|
||||
public function verifyPassword(string $email, string $password): bool;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{% block page_title %}{% endblock %}</title>
|
||||
<meta name="description" value="{{ site_description }}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
7
app/templates/users/success.twig
Normal file
7
app/templates/users/success.twig
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends 'layouts/skeleton.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div>
|
||||
<p>Successfully registered {{ email }}.</p>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user