Fix couple of security issues

This commit is contained in:
DariusIII
2026-06-11 10:26:29 +02:00
parent 3dfbd8442f
commit 832fb5fb59
17 changed files with 875 additions and 289 deletions
@@ -67,22 +67,17 @@ class ForgotPasswordController extends Controller
}
}
// Check users exists and send an email
// Check whether the user exists, but always return the same success message
// to avoid account/API-key enumeration.
$ret = ! empty($rssToken) ? User::findByRssToken($rssToken) : User::findByEmail($email);
if ($ret === null) {
return redirect()
->route('forgottenpassword')
->withErrors(['error' => 'The email or apikey are not recognised.'])
->withInput($request->except(CaptchaHelper::getResponseFieldName()));
return redirect()->route('forgottenpassword')->with('success', 'Password reset email has been sent!');
}
// Check if user is soft deleted
$user = User::withTrashed()->find($ret['id']);
if ($user && $user->trashed()) {
return redirect()
->route('forgottenpassword')
->withErrors(['error' => 'This account has been deactivated.'])
->withInput($request->except(CaptchaHelper::getResponseFieldName()));
return redirect()->route('forgottenpassword')->with('success', 'Password reset email has been sent!');
}
// Generate a forgottenpassword guid, store it in the user table