Update password reset

This commit is contained in:
DariusIII
2025-01-11 21:02:59 +01:00
parent 2a00a08338
commit 822f22ed45
5 changed files with 25 additions and 27 deletions
@@ -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';
+2 -5
View File
@@ -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);
Generated
+12 -12
View File
@@ -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",
@@ -21,7 +21,7 @@
us</a>.</p>
{{Form::open(['url' => 'forgottenpassword?action=submit'])}}
<div class="form-group has-feedback">
<input autocomplete="off" id="email" name="email" value="{$email}" type="email" class="form-control"
<input autocomplete="off" id="email" name="email" value="{$email}" type="email" class="form-inline"
placeholder="Email"/>
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
+1 -1
View File
@@ -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');