Skip to content

Commit

Permalink
prohibition to change data for a test account
Browse files Browse the repository at this point in the history
  • Loading branch information
makssein committed Aug 30, 2023
1 parent e70ea6e commit 3362c93
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions app/Http/Controllers/Web/Account/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ public function render() {
}

public function newInfo(NewInfoRequest $request) {
if(auth()->user()->username === 'user') { //это тестовый аккаунт для тех, кто не хочет регистрироваться, на нем нельзя менять данные, нужные для логина
return response()->json([
'status' => true,
'type' => 'success',
'message' => 'На данном аккаунте нельзя менять имя пользователя.'
]);
}

auth()->user()->username = $request->post('username');
$save = auth()->user()->save();

Expand All @@ -34,6 +42,14 @@ public function newInfo(NewInfoRequest $request) {
}

public function newPassword(NewPasswordRequest $request) {
if(auth()->user()->username === 'user') { //это тестовый аккаунт для тех, кто не хочет регистрироваться, на нем нельзя менять данные, нужные для логина
return response()->json([
'status' => true,
'type' => 'success',
'message' => 'На данном аккаунте нельзя менять пароль.'
]);
}

auth()->user()->password = Hash::make($request->post('new_password'));
$save = auth()->user()->save();

Expand Down

0 comments on commit 3362c93

Please sign in to comment.