Compare commits

..

No commits in common. "fd30911dd31625b6eef7b1b76d9e246015e3e318" and "4161abe098b013dc698c9f33b3932f17ecad2574" have entirely different histories.

5 changed files with 14 additions and 19 deletions

View File

@ -10,7 +10,7 @@
} }
], ],
"require": { "require": {
"esoko/soko-web": "0.5", "esoko/soko-web": "0.4",
"firebase/php-jwt": "^6.4" "firebase/php-jwt": "^6.4"
}, },
"require-dev": { "require-dev": {

8
composer.lock generated
View File

@ -4,15 +4,15 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "05dba423c5e5dd40b5a7b9d4180d3673", "content-hash": "f7786e07bcb0373560ae67549fa28f0b",
"packages": [ "packages": [
{ {
"name": "esoko/soko-web", "name": "esoko/soko-web",
"version": "v0.5", "version": "v0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.esoko.eu/esoko/soko-web.git", "url": "https://git.esoko.eu/esoko/soko-web.git",
"reference": "3893ed22316e84aa4ffab7fbb3d5e823b928b001" "reference": "948b36c80d324e07339a543d97b9e629487f3a45"
}, },
"require": { "require": {
"phpmailer/phpmailer": "^6.8", "phpmailer/phpmailer": "^6.8",
@ -33,7 +33,7 @@
"GNU GPL 3.0" "GNU GPL 3.0"
], ],
"description": "Lightweight web framework", "description": "Lightweight web framework",
"time": "2023-04-18T21:17:08+00:00" "time": "2023-04-16T18:52:06+00:00"
}, },
{ {
"name": "firebase/php-jwt", "name": "firebase/php-jwt",

View File

@ -226,12 +226,16 @@ class LoginController
$passwordResetter->setToken($token); $passwordResetter->setToken($token);
$passwordResetter->setExpiresDate($expires); $passwordResetter->setExpiresDate($expires);
\Container::$dbConnection->startTransaction();
if ($existingResetter !== null) { if ($existingResetter !== null) {
$this->pdm->deleteFromDb($existingResetter); $this->pdm->deleteFromDb($existingResetter);
} }
$this->pdm->saveToDb($passwordResetter); $this->pdm->saveToDb($passwordResetter);
\Container::$dbConnection->commit();
$this->sendPasswordResetEmail($user->getEmail(), $token, $expires); $this->sendPasswordResetEmail($user->getEmail(), $token, $expires);
return new JsonContent(['success' => true]); return new JsonContent(['success' => true]);
@ -271,6 +275,8 @@ class LoginController
return new JsonContent(['error' => ['errorText' => 'The given passwords do not match.']]); return new JsonContent(['error' => ['errorText' => 'The given passwords do not match.']]);
} }
\Container::$dbConnection->startTransaction();
$this->pdm->deleteFromDb($resetter); $this->pdm->deleteFromDb($resetter);
$user = $this->userRepository->getById($resetter->getUserId()); $user = $this->userRepository->getById($resetter->getUserId());
@ -278,6 +284,8 @@ class LoginController
$this->pdm->saveToDb($user); $this->pdm->saveToDb($user);
\Container::$dbConnection->commit();
$this->request->setUser($user); $this->request->setUser($user);
$this->deleteRedirectUrl(); $this->deleteRedirectUrl();

View File

@ -1,11 +0,0 @@
@extends(templates/layout_normal)
@section(main)
<h2>500 | Internal server error</h2>
<p>An error occured during processing your request. <a href="<?= Container::$routeCollection->getRoute('home')->generateLink() ?>" title="<?= $_ENV['APP_NAME'] ?>">Back to start.</a></p>
<?php if (isset($exceptionToPrint)): ?>
<pre class="marginTop">
<?= $exceptionToPrint ?>
</pre>
<?php endif; ?>
@endsection

View File

@ -108,13 +108,11 @@ $appConfig = [
'antiCsrfTokenErrorResponse' => ['error' => 'no_valid_anti_csrf_token'], 'antiCsrfTokenErrorResponse' => ['error' => 'no_valid_anti_csrf_token'],
'antiCsrfTokenExceptions' => ['/oauth/token'], 'antiCsrfTokenExceptions' => ['/oauth/token'],
'loginRouteId' => 'login', 'loginRouteId' => 'login',
'error404View' => 'error/404', 'error404View' => 'error/404'
'error500View' => 'error/500'
]; ];
$httpReponse = new HttpResponse( $httpReponse = new HttpResponse(
Container::$request, Container::$request,
Container::$dbConnection,
Container::$routeCollection, Container::$routeCollection,
$appConfig, $appConfig,
$_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_METHOD'],