mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[ANY] Laravel auth controller (#361)
This commit is contained in:
parent
c44384ccb2
commit
606eca22aa
1 changed files with 6 additions and 8 deletions
|
@ -12,10 +12,9 @@ class LauncherAuthController extends Controller
|
|||
$data = json_decode($request->getContent());
|
||||
|
||||
if ($data->apiKey !== env('LAUNCHER_APIKEY')) {
|
||||
$response = [
|
||||
return response()->json([
|
||||
'error' => 'Неверный ключ. Обратитесь к администратору',
|
||||
];
|
||||
return json_encode($response);
|
||||
]);
|
||||
}
|
||||
|
||||
if (Auth::attempt(['name' => $data->username, 'password' => $data->password])) {
|
||||
|
@ -24,15 +23,14 @@ class LauncherAuthController extends Controller
|
|||
->where('name', '=', $data->username)
|
||||
->first();
|
||||
|
||||
$response = [
|
||||
return response()->json([
|
||||
'username' => $data->username,
|
||||
'permission' => $perm->launcher_permission,
|
||||
];
|
||||
]);
|
||||
} else {
|
||||
$response = [
|
||||
return response()->json([
|
||||
'error' => 'Неверный логин или пароль',
|
||||
];
|
||||
}
|
||||
return json_encode($response);
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue