From 822f22ed45b58ca3cbbd9afa115730d87cdc2c21 Mon Sep 17 00:00:00 2001
From: DariusIII
Date: Sat, 11 Jan 2025 21:02:59 +0100
Subject: [PATCH] Update password reset
---
.../Auth/ForgotPasswordController.php | 17 ++++++-------
app/Http/Controllers/BasePageController.php | 7 ++----
composer.lock | 24 +++++++++----------
.../themes/Gentele/forgottenpassword.tpl | 2 +-
routes/web.php | 2 +-
5 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php
index 37f8fdca1..e2508ad9b 100644
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php
@@ -3,10 +3,9 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
-use App\Http\Requests\Auth\ShowLinkRequestFormForgotPasswordRequest;
use App\Jobs\SendPasswordForgottenEmail;
use App\Models\User;
-use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
+use Illuminate\Http\Request;
use Illuminate\Support\Str;
class ForgotPasswordController extends Controller
@@ -22,8 +21,6 @@ class ForgotPasswordController extends Controller
|
*/
- use SendsPasswordResetEmails;
-
/**
* Create a new controller instance.
*
@@ -37,7 +34,7 @@ class ForgotPasswordController extends Controller
/**
* @throws \Exception
*/
- public function showLinkRequestForm(ShowLinkRequestFormForgotPasswordRequest $request): void
+ public function showLinkRequestForm(Request $request): void
{
$sent = '';
$email = $request->input('email') ?? '';
@@ -46,6 +43,10 @@ class ForgotPasswordController extends Controller
app('smarty.view')->assign('error', 'Missing parameter (email and/or apikey) to send password reset');
} else {
if (config('captcha.enabled') === true && (! empty(config('captcha.secret')) && ! empty(config('captcha.sitekey')))) {
+ $captcha = app('captcha');
+ if (! $captcha->validate($request)) {
+ app('smarty.view')->assign('error', 'Captcha validation failed.');
+ }
}
//
// Check users exists and send an email
@@ -53,7 +54,6 @@ class ForgotPasswordController extends Controller
$ret = ! empty($rssToken) ? User::getByRssToken($rssToken) : User::getByEmail($email);
if ($ret === null) {
app('smarty.view')->assign('error', 'The email or apikey are not recognised.');
- $sent = true;
} else {
//
// Generate a forgottenpassword guid, store it in the user table
@@ -64,9 +64,10 @@ class ForgotPasswordController extends Controller
// Send the email
//
$resetLink = url('/').'/resetpassword?guid='.$guid;
- SendPasswordForgottenEmail::dispatch($ret, $resetLink);
- $sent = true;
+ dd(SendPasswordForgottenEmail::dispatch($ret, $resetLink));
+ app('smarty.view')->assign('success', 'Password reset email has been sent!');
}
+ $sent = true;
}
$theme = 'Gentele';
diff --git a/app/Http/Controllers/BasePageController.php b/app/Http/Controllers/BasePageController.php
index a42ddbccd..55462c56d 100644
--- a/app/Http/Controllers/BasePageController.php
+++ b/app/Http/Controllers/BasePageController.php
@@ -53,7 +53,7 @@ class BasePageController extends Controller
*/
public function __construct()
{
- $this->middleware(['auth', 'web', '2fa'])->except('api', 'contact', 'showContactForm', 'callback', 'getNzb', 'terms', 'capabilities', 'movie', 'apiSearch', 'tv', 'details', 'failed', 'showRssDesc', 'fullFeedRss', 'categoryFeedRss', 'cartRss', 'myMoviesRss', 'myShowsRss', 'release');
+ $this->middleware(['auth', 'web', '2fa'])->except('api', 'contact', 'showContactForm', 'callback', 'getNzb', 'terms', 'capabilities', 'movie', 'apiSearch', 'tv', 'details', 'failed', 'showRssDesc', 'fullFeedRss', 'categoryFeedRss', 'cartRss', 'myMoviesRss', 'myShowsRss', 'release', 'reset', 'showLinkRequestForm');
// Buffer settings/DB connection.
$this->settings = new Settings;
$this->smarty = app('smarty.view');
@@ -157,10 +157,7 @@ class BasePageController extends Controller
'default' => config('ytake-laravel-smarty.template_path').'/Gentele',
]);
- $role = User::ROLE_USER;
- if (! empty($this->userdata)) {
- $role = $this->userdata->roles_id;
- }
+ $role = $this->userdata->roles_id ?? User::ROLE_USER;
$content = new Contents;
$parentcatlist = Category::getForMenu($this->userdata->categoryexclusions);
diff --git a/composer.lock b/composer.lock
index 3354de34e..d2de920e8 100644
--- a/composer.lock
+++ b/composer.lock
@@ -6919,16 +6919,16 @@
},
{
"name": "php-ffmpeg/php-ffmpeg",
- "version": "v1.3.0",
+ "version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/PHP-FFMpeg/PHP-FFMpeg.git",
- "reference": "5e7b15710a8607e8a3a2d9fbe2c150a99b924fa5"
+ "reference": "0fbbc4c6a6336155679adc800616001ae3328c7a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHP-FFMpeg/PHP-FFMpeg/zipball/5e7b15710a8607e8a3a2d9fbe2c150a99b924fa5",
- "reference": "5e7b15710a8607e8a3a2d9fbe2c150a99b924fa5",
+ "url": "https://api.github.com/repos/PHP-FFMpeg/PHP-FFMpeg/zipball/0fbbc4c6a6336155679adc800616001ae3328c7a",
+ "reference": "0fbbc4c6a6336155679adc800616001ae3328c7a",
"shasum": ""
},
"require": {
@@ -7002,9 +7002,9 @@
],
"support": {
"issues": "https://github.com/PHP-FFMpeg/PHP-FFMpeg/issues",
- "source": "https://github.com/PHP-FFMpeg/PHP-FFMpeg/tree/v1.3.0"
+ "source": "https://github.com/PHP-FFMpeg/PHP-FFMpeg/tree/v1.3.1"
},
- "time": "2024-11-12T15:39:52+00:00"
+ "time": "2025-01-10T20:23:57+00:00"
},
{
"name": "php-http/discovery",
@@ -14287,16 +14287,16 @@
},
{
"name": "captainhook/captainhook",
- "version": "5.24.1",
+ "version": "5.24.2",
"source": {
"type": "git",
"url": "https://github.com/captainhookphp/captainhook.git",
- "reference": "1e56452fd7a7e486e5955ab72dc9ea34bb52a184"
+ "reference": "3e0915ff063a14d745c78e0181868e79c596b7e0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/captainhookphp/captainhook/zipball/1e56452fd7a7e486e5955ab72dc9ea34bb52a184",
- "reference": "1e56452fd7a7e486e5955ab72dc9ea34bb52a184",
+ "url": "https://api.github.com/repos/captainhookphp/captainhook/zipball/3e0915ff063a14d745c78e0181868e79c596b7e0",
+ "reference": "3e0915ff063a14d745c78e0181868e79c596b7e0",
"shasum": ""
},
"require": {
@@ -14359,7 +14359,7 @@
],
"support": {
"issues": "https://github.com/captainhookphp/captainhook/issues",
- "source": "https://github.com/captainhookphp/captainhook/tree/5.24.1"
+ "source": "https://github.com/captainhookphp/captainhook/tree/5.24.2"
},
"funding": [
{
@@ -14367,7 +14367,7 @@
"type": "github"
}
],
- "time": "2024-11-26T18:42:37+00:00"
+ "time": "2025-01-11T12:52:49+00:00"
},
{
"name": "captainhook/plugin-composer",
diff --git a/resources/views/themes/Gentele/forgottenpassword.tpl b/resources/views/themes/Gentele/forgottenpassword.tpl
index 064d505b1..597e7f8d0 100755
--- a/resources/views/themes/Gentele/forgottenpassword.tpl
+++ b/resources/views/themes/Gentele/forgottenpassword.tpl
@@ -21,7 +21,7 @@
us.
{{Form::open(['url' => 'forgottenpassword?action=submit'])}}
-
diff --git a/routes/web.php b/routes/web.php
index d90a7428a..d6c452e5d 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -76,7 +76,7 @@ Route::match(['GET', 'POST'], '/', [ContentController::class, 'show'])->name('ho
Route::get('register', [RegisterController::class, 'showRegistrationForm'])->name('register');
Route::post('register', [RegisterController::class, 'register'])->name('register.post');
-Route::match(['GET', 'POST'], 'forgottenpassword', [ForgotPasswordController::class, 'showLinkRequestForm'])->name('forgottenpassword');
+Route::match(['GET', 'POST'], 'forgottenpassword', [ForgotPasswordController::class, 'showLinkRequestForm'])->name('forgottenpassword')->withoutMiddleware(['auth', 'VerifyCsrfToken', 'web']);
Route::match(['GET', 'POST'], 'terms-and-conditions', [TermsController::class, 'terms'])->name('terms-and-conditions');
Route::get('login', [LoginController::class, 'showLoginForm'])->name('login');