mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add restrictions for demo accounts.
This commit is contained in:
parent
ede327f3d3
commit
bce4e7e2bf
@ -51,6 +51,12 @@ class ProfileController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function changePassword()
|
public function changePassword()
|
||||||
{
|
{
|
||||||
|
if (auth()->user()->hasRole('demo')) {
|
||||||
|
Session::flash('info', strval(trans('firefly.cannot_change_demo')));
|
||||||
|
|
||||||
|
return redirect(route('profile.index'));
|
||||||
|
}
|
||||||
|
|
||||||
$title = auth()->user()->email;
|
$title = auth()->user()->email;
|
||||||
$subTitle = strval(trans('firefly.change_your_password'));
|
$subTitle = strval(trans('firefly.change_your_password'));
|
||||||
$subTitleIcon = 'fa-key';
|
$subTitleIcon = 'fa-key';
|
||||||
@ -63,6 +69,12 @@ class ProfileController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function deleteAccount()
|
public function deleteAccount()
|
||||||
{
|
{
|
||||||
|
if (auth()->user()->hasRole('demo')) {
|
||||||
|
Session::flash('info', strval(trans('firefly.cannot_delete_demo')));
|
||||||
|
|
||||||
|
return redirect(route('profile.index'));
|
||||||
|
}
|
||||||
|
|
||||||
$title = auth()->user()->email;
|
$title = auth()->user()->email;
|
||||||
$subTitle = strval(trans('firefly.delete_account'));
|
$subTitle = strval(trans('firefly.delete_account'));
|
||||||
$subTitleIcon = 'fa-trash';
|
$subTitleIcon = 'fa-trash';
|
||||||
@ -90,6 +102,12 @@ class ProfileController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postChangePassword(ProfileFormRequest $request, UserRepositoryInterface $repository)
|
public function postChangePassword(ProfileFormRequest $request, UserRepositoryInterface $repository)
|
||||||
{
|
{
|
||||||
|
if (auth()->user()->hasRole('demo')) {
|
||||||
|
Session::flash('info', strval(trans('firefly.cannot_change_demo')));
|
||||||
|
|
||||||
|
return redirect(route('profile.index'));
|
||||||
|
}
|
||||||
|
|
||||||
// old, new1, new2
|
// old, new1, new2
|
||||||
if (!Hash::check($request->get('current_password'), auth()->user()->password)) {
|
if (!Hash::check($request->get('current_password'), auth()->user()->password)) {
|
||||||
Session::flash('error', strval(trans('firefly.invalid_current_password')));
|
Session::flash('error', strval(trans('firefly.invalid_current_password')));
|
||||||
@ -118,6 +136,12 @@ class ProfileController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postDeleteAccount(UserRepositoryInterface $repository, DeleteAccountFormRequest $request)
|
public function postDeleteAccount(UserRepositoryInterface $repository, DeleteAccountFormRequest $request)
|
||||||
{
|
{
|
||||||
|
if (auth()->user()->hasRole('demo')) {
|
||||||
|
Session::flash('info', strval(trans('firefly.cannot_delete_demo')));
|
||||||
|
|
||||||
|
return redirect(route('profile.index'));
|
||||||
|
}
|
||||||
|
|
||||||
// old, new1, new2
|
// old, new1, new2
|
||||||
if (!Hash::check($request->get('password'), auth()->user()->password)) {
|
if (!Hash::check($request->get('password'), auth()->user()->password)) {
|
||||||
Session::flash('error', strval(trans('firefly.invalid_password')));
|
Session::flash('error', strval(trans('firefly.invalid_password')));
|
||||||
|
@ -96,6 +96,8 @@ return [
|
|||||||
'spent_in_specific_budget' => 'Spent in budget ":budget"',
|
'spent_in_specific_budget' => 'Spent in budget ":budget"',
|
||||||
'sum_of_expenses_in_budget' => 'Spent total in budget ":budget"',
|
'sum_of_expenses_in_budget' => 'Spent total in budget ":budget"',
|
||||||
'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_delete_demo' => 'You cannot remove the demonstration account.',
|
||||||
|
|
||||||
// repeat frequencies:
|
// repeat frequencies:
|
||||||
'repeat_freq_yearly' => 'yearly',
|
'repeat_freq_yearly' => 'yearly',
|
||||||
|
Loading…
Reference in New Issue
Block a user