commit
This commit is contained in:
@@ -19,6 +19,7 @@ class AuthController extends Controller
|
||||
'username' => 'required|string|unique:users',
|
||||
'nokp' => 'required|string|unique:users',
|
||||
'password' => 'required|string|min:8',
|
||||
'email' => 'required|string|unique:users|email',
|
||||
'notelbimbit' => 'required|string|unique:users',
|
||||
'register_agree' => 'required|integer'
|
||||
|
||||
@@ -45,6 +46,7 @@ class AuthController extends Controller
|
||||
$user->username = $fields['username'];
|
||||
$user->nokp = $fields['nokp'];
|
||||
$user->password = bcrypt($fields['password']);
|
||||
$user->email = $fields['email'];
|
||||
$user->notelbimbit = $fields['notelbimbit'];
|
||||
$user->register_agree = $fields['register_agree'];
|
||||
$user->t_daftar = $currentdate;
|
||||
@@ -85,7 +87,25 @@ class AuthController extends Controller
|
||||
|
||||
//Check username
|
||||
$user = User::where('username', $fields['username'])->first();
|
||||
|
||||
|
||||
if($user->status != 'active')
|
||||
{
|
||||
if($user->status == 'banned')
|
||||
{
|
||||
return response([
|
||||
'message' => 'User Banned'
|
||||
], 401);
|
||||
}
|
||||
else
|
||||
{
|
||||
return response([
|
||||
'message' => 'Registration in progress,status wait for approval.'
|
||||
], 401);
|
||||
}
|
||||
return response([
|
||||
'message' => 'Bad Creds'
|
||||
], 401);
|
||||
}
|
||||
//Check Password
|
||||
if(!$user || !Hash::check($fields['password'], $user->password)){
|
||||
return response([
|
||||
|
||||
Reference in New Issue
Block a user