mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
updated return jwt after verify phone
This commit is contained in:
+1
-1
@@ -4,6 +4,6 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
RUN composer install
|
||||
RUN composer update
|
||||
ADD start.sh /start.sh
|
||||
CMD ["/start.sh"]
|
||||
@@ -79,14 +79,16 @@ class AuthController extends Controller
|
||||
$check_user->is_verified = 1;
|
||||
$check_user->save();
|
||||
$check_token->delete();
|
||||
return response()->json([
|
||||
'success'=> true,
|
||||
'message'=> 'Completed'
|
||||
]);
|
||||
}
|
||||
|
||||
if (!$userToken=JWTAuth::fromUser($check_user)) {
|
||||
return response()->json(['error' => 'invalid_credentials'], 401);
|
||||
}
|
||||
// all good so return the token
|
||||
return response()->json(['success' => true, 'data'=> [ 'token' => $userToken ]]);
|
||||
}
|
||||
return response()->json(['success'=> false, 'error'=> "Verification code is invalid."]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API Register
|
||||
*
|
||||
@@ -95,7 +97,7 @@ class AuthController extends Controller
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
$credentials = $request->only('name', 'phone', 'password', 'confirm_password');
|
||||
$credentials = $request->only('role', 'name', 'password', 'confirm_password');
|
||||
|
||||
$rules = [
|
||||
'name' => 'required|max:255',
|
||||
@@ -122,6 +124,7 @@ class AuthController extends Controller
|
||||
return response()->json(['success'=> true, 'message'=> 'A verification code has been send to your mobile number.']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API Login, on success return JWT Auth token
|
||||
*
|
||||
|
||||
+2
-1
@@ -11,7 +11,8 @@
|
||||
"fideloper/proxy": "^4.0",
|
||||
"laravel/framework": "5.6.*",
|
||||
"laravel/tinker": "^1.0",
|
||||
"tymon/jwt-auth": "1.0.*"
|
||||
"tymon/jwt-auth": "1.0.*",
|
||||
"zizaco/entrust": "5.2.x-dev"
|
||||
},
|
||||
"require-dev": {
|
||||
"filp/whoops": "^2.0",
|
||||
|
||||
@@ -151,6 +151,7 @@ return [
|
||||
*/
|
||||
Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
|
||||
Aloha\Twilio\Support\Laravel\ServiceProvider::class,
|
||||
Zizaco\Entrust\EntrustServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
@@ -212,6 +213,7 @@ return [
|
||||
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
|
||||
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
|
||||
'Twilio' => Aloha\Twilio\Support\Laravel\Facade::class,
|
||||
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
|
||||
|
||||
],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user