mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Can no longer reset the demo user’s password.
This commit is contained in:
parent
48209d0d22
commit
c86aa9cb3f
@ -13,7 +13,9 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Http\Controllers\Auth;
|
namespace FireflyIII\Http\Controllers\Auth;
|
||||||
|
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
|
use FireflyIII\User;
|
||||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ForgotPasswordController
|
* Class ForgotPasswordController
|
||||||
@ -33,4 +35,39 @@ class ForgotPasswordController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware('guest');
|
$this->middleware('guest');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a reset link to the given user.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function sendResetLinkEmail(Request $request)
|
||||||
|
{
|
||||||
|
$this->validate($request, ['email' => 'required|email']);
|
||||||
|
|
||||||
|
// verify if the user is not a demo user. If so, we give him back an error.
|
||||||
|
$user = User::where('email', $request->get('email'))->first();
|
||||||
|
if (!is_null($user) && $user->hasRole('demo')) {
|
||||||
|
return back()->withErrors(
|
||||||
|
['email' => trans('firefly.cannot_reset_demo_user')]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $this->broker()->sendResetLink(
|
||||||
|
$request->only('email')
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($response === Password::RESET_LINK_SENT) {
|
||||||
|
return back()->with('status', trans($response));
|
||||||
|
}
|
||||||
|
|
||||||
|
// If an error was returned by the password broker, we will get this message
|
||||||
|
// translated so we can notify a user of the problem. We'll redirect back
|
||||||
|
// to where the users came from so they can attempt this process again.
|
||||||
|
return back()->withErrors(
|
||||||
|
['email' => trans($response)]
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,7 @@ return [
|
|||||||
'left_in_budget_limit' => 'Left to spend according to budgeting',
|
'left_in_budget_limit' => 'Left to spend according to budgeting',
|
||||||
'cannot_change_demo' => 'You cannot change the password of the demonstration account.',
|
'cannot_change_demo' => 'You cannot change the password of the demonstration account.',
|
||||||
'cannot_delete_demo' => 'You cannot remove the demonstration account.',
|
'cannot_delete_demo' => 'You cannot remove the demonstration account.',
|
||||||
|
'cannot_reset_demo_user' => 'You cannot reset the password of the demonstration account',
|
||||||
|
|
||||||
// repeat frequencies:
|
// repeat frequencies:
|
||||||
'repeat_freq_yearly' => 'yearly',
|
'repeat_freq_yearly' => 'yearly',
|
||||||
|
Loading…
Reference in New Issue
Block a user