This commit is contained in:
Sándor Máté Magony
2025-05-11 13:07:54 +02:00
parent ec057787fd
commit a85c207b44
13 changed files with 25 additions and 169 deletions

View File

@@ -35,7 +35,7 @@ class AuthController extends Controller
'nev' => $request->nev,
'email' => $request->email,
'felh_nev' => $request->felh_nev,
'jelszo' => $request->jelszo, // This will be hashed via the mutator
'jelszo' => $request->jelszo,
'is_admin' => $request->is_admin ?? false
]);
@@ -56,10 +56,9 @@ class AuthController extends Controller
return response()->json($validator->errors(), 422);
}
// Since your login fields are custom, you need to specify the fields
$credentials = [
'felh_nev' => $request->felh_nev,
'password' => $request->jelszo // Laravel expects 'password' internally
'password' => $request->jelszo
];
if (!$token = auth('api')->attempt($credentials)) {
@@ -96,7 +95,7 @@ class AuthController extends Controller
return response()->json([
'access_token' => $token,
'token_type' => 'bearer',
'expires_in' => config('jwt.ttl') * 60, // Getting TTL from config
'expires_in' => config('jwt.ttl') * 60,
'user' => auth('api')->user()
]);
}