Fix registration call.
このコミットが含まれているのは:
コミット
6a5b75abff
|
@ -182,7 +182,7 @@ class AuthController extends Controller {
|
|||
}
|
||||
|
||||
public function register(Request $request) {
|
||||
$credentials = $request->only('username', 'password');
|
||||
$credentials = $request->only('username', 'email', 'password');
|
||||
|
||||
$rules = [
|
||||
'username' => 'required|max:255|unique:users',
|
||||
|
@ -209,7 +209,18 @@ class AuthController extends Controller {
|
|||
'gender' => $gender
|
||||
]);
|
||||
|
||||
return $this->login($request);
|
||||
try {
|
||||
// attempt to verify the credentials and create a token for the user
|
||||
if (!$token = JWTAuth::attempt($credentials)) {
|
||||
return response()->json(['success' => false, 'error' => 'We cant find an account with this credentials.'], 401);
|
||||
}
|
||||
}
|
||||
catch (JWTException $e) {
|
||||
// something went wrong whilst attempting to encode the token
|
||||
return response()->json(['success' => false, 'error' => 'Failed to login, please try again.'], 500);
|
||||
}
|
||||
// all good so return the token
|
||||
return response()->json(['success' => true, 'data'=> [ 'token' => $token ]]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
新しいイシューから参照