@@ -15,8 +15,8 @@ |
||
| 15 | 15 | { |
| 16 | 16 | include __DIR__.'/BantenprovSso.php'; |
| 17 | 17 | $this->publishes([ |
| 18 | - __DIR__ . '/views' => base_path('public/js'), |
|
| 19 | - __DIR__ . '/controllers' => base_path('app/Http/Controllers'), |
|
| 18 | + __DIR__.'/views' => base_path('public/js'), |
|
| 19 | + __DIR__.'/controllers' => base_path('app/Http/Controllers'), |
|
| 20 | 20 | ]); |
| 21 | 21 | $this->commands('Bantenprov\BantenprovSso\Commands\RouteCommands'); |
| 22 | 22 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | public function login() |
| 15 | 15 | { |
| 16 | - if(!Auth::check()) |
|
| 16 | + if (!Auth::check()) |
|
| 17 | 17 | { |
| 18 | 18 | return view('pages.credential.login'); |
| 19 | 19 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'password' => 'required' |
| 29 | 29 | ]); |
| 30 | 30 | |
| 31 | - if($validator->fails()) |
|
| 31 | + if ($validator->fails()) |
|
| 32 | 32 | { |
| 33 | 33 | Session::flash('message', 'Data tidak boleh kosong'); |
| 34 | 34 | return redirect()->back() |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | //set session |
| 45 | 45 | Session(['ipaddress' => $request->input('ip1').'-'.$request->input('ip2')]); |
| 46 | 46 | |
| 47 | - if(!BantenprovSso::Attempt($credential)) |
|
| 47 | + if (!BantenprovSso::Attempt($credential)) |
|
| 48 | 48 | { |
| 49 | 49 | //dd(BantenprovSso::message()); |
| 50 | 50 | Session::flash('message', 'terjadi kesalah, login tidak berhasil'); |
@@ -57,14 +57,14 @@ discard block |
||
| 57 | 57 | //check data user pada table user |
| 58 | 58 | $user = User::where('email', $data->email) |
| 59 | 59 | ->first(); |
| 60 | - if(count($user) == 0) |
|
| 60 | + if (count($user) == 0) |
|
| 61 | 61 | { |
| 62 | 62 | //return 'gak ada'; |
| 63 | 63 | //insert data user |
| 64 | 64 | $create_user = new User; |
| 65 | 65 | $create_user->email = $data->email; |
| 66 | 66 | $create_user->name = $data->name; |
| 67 | - $create_user->password = $data->password; |
|
| 67 | + $create_user->password = $data->password; |
|
| 68 | 68 | $create_user->save(); |
| 69 | 69 | |
| 70 | 70 | return Self::init_login($create_user); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | //login with id |
| 82 | 82 | //dd($data->id); |
| 83 | - if(Auth::loginUsingId($data->id)) |
|
| 83 | + if (Auth::loginUsingId($data->id)) |
|
| 84 | 84 | { |
| 85 | 85 | return redirect::to('dashboard'); |
| 86 | 86 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | public function check_logout(Request $request) |
| 98 | 98 | { |
| 99 | - if(BantenprovSso::check_logout(['ipaddress' => $request->input('ipaddress')])) |
|
| 99 | + if (BantenprovSso::check_logout(['ipaddress' => $request->input('ipaddress')])) |
|
| 100 | 100 | { |
| 101 | 101 | return 1; |
| 102 | 102 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function check_login(Request $request) |
| 110 | 110 | { |
| 111 | 111 | $check = BantenprovSso::check_login(['ipaddress' => $request->input('ipaddress')]); |
| 112 | - if(!$check) |
|
| 112 | + if (!$check) |
|
| 113 | 113 | { |
| 114 | 114 | return 0; |
| 115 | 115 | } |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | // cari atau simpan data baru |
| 119 | 119 | $teng = BantenprovSso::check_login_data(); |
| 120 | 120 | $user_data = User::where('email', $teng->email)->first(); |
| 121 | - if(count($user_data) == 0) |
|
| 121 | + if (count($user_data) == 0) |
|
| 122 | 122 | { |
| 123 | 123 | //simpan data baru |
| 124 | 124 | $simpan = new User; |
| 125 | - $simpan->email = $teng->email; |
|
| 126 | - $simpan->name = $teng->name; |
|
| 127 | - $simpan->password = 'bantenprov'; |
|
| 125 | + $simpan->email = $teng->email; |
|
| 126 | + $simpan->name = $teng->name; |
|
| 127 | + $simpan->password = 'bantenprov'; |
|
| 128 | 128 | $simpan->save(); |
| 129 | 129 | |
| 130 | 130 | Auth::loginUsingId($simpan->id); |
@@ -62,6 +62,6 @@ |
||
| 62 | 62 | public function handle() |
| 63 | 63 | { |
| 64 | 64 | $this->info('Route add success'); |
| 65 | - File::append(base_path('routes/web.php'),"\n".$this->content()); |
|
| 65 | + File::append(base_path('routes/web.php'), "\n".$this->content()); |
|
| 66 | 66 | } |
| 67 | 67 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | public function __construct() |
| 26 | 26 | { |
| 27 | - Self::$fails = false; |
|
| 27 | + Self::$fails = false; |
|
| 28 | 28 | Self::$profile_fails = false; |
| 29 | 29 | Self::$token_access = false; |
| 30 | 30 | $this->profile = ''; |
@@ -35,17 +35,17 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $post['appid'] = env('APPID'); |
| 37 | 37 | $post['token'] = env('TOKEN'); |
| 38 | - $curl=curl_init(); |
|
| 39 | - curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
|
| 40 | - curl_setopt($curl,CURLOPT_URL,env('SSO_LOGIN')); |
|
| 41 | - curl_setopt($curl,CURLOPT_POST,1); |
|
| 42 | - curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
|
| 43 | - curl_setopt($curl,CURLOPT_TIMEOUT,20); |
|
| 44 | - curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
|
| 38 | + $curl = curl_init(); |
|
| 39 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
|
| 40 | + curl_setopt($curl, CURLOPT_URL, env('SSO_LOGIN')); |
|
| 41 | + curl_setopt($curl, CURLOPT_POST, 1); |
|
| 42 | + curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); |
|
| 43 | + curl_setopt($curl, CURLOPT_TIMEOUT, 20); |
|
| 44 | + curl_setopt($curl, CURLOPT_HTTPHEADER, array( |
|
| 45 | 45 | 'Accept: application/json') |
| 46 | 46 | ); |
| 47 | - $exec=curl_exec($curl); |
|
| 48 | - if(!$exec) |
|
| 47 | + $exec = curl_exec($curl); |
|
| 48 | + if (!$exec) |
|
| 49 | 49 | { |
| 50 | 50 | return BantenprovSso::$fails = true; |
| 51 | 51 | } |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $post['appid'] = env('APPID'); |
| 66 | 66 | $post['token'] = env('TOKEN'); |
| 67 | - $curl=curl_init(); |
|
| 68 | - curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
|
| 69 | - curl_setopt($curl,CURLOPT_URL,env('CHECK_LOGOUT')); |
|
| 70 | - curl_setopt($curl,CURLOPT_POST,1); |
|
| 71 | - curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
|
| 72 | - curl_setopt($curl,CURLOPT_TIMEOUT,20); |
|
| 73 | - curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
|
| 67 | + $curl = curl_init(); |
|
| 68 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
|
| 69 | + curl_setopt($curl, CURLOPT_URL, env('CHECK_LOGOUT')); |
|
| 70 | + curl_setopt($curl, CURLOPT_POST, 1); |
|
| 71 | + curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); |
|
| 72 | + curl_setopt($curl, CURLOPT_TIMEOUT, 20); |
|
| 73 | + curl_setopt($curl, CURLOPT_HTTPHEADER, array( |
|
| 74 | 74 | 'Accept: application/json') |
| 75 | 75 | ); |
| 76 | - $exec=curl_exec($curl); |
|
| 77 | - if(!$exec) |
|
| 76 | + $exec = curl_exec($curl); |
|
| 77 | + if (!$exec) |
|
| 78 | 78 | { |
| 79 | 79 | return false; |
| 80 | 80 | } |
@@ -87,20 +87,20 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | $post['appid'] = env('APPID'); |
| 89 | 89 | $post['token'] = env('TOKEN'); |
| 90 | - $curl=curl_init(); |
|
| 91 | - curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
|
| 92 | - curl_setopt($curl,CURLOPT_URL,env('CHECK_LOGIN')); |
|
| 93 | - curl_setopt($curl,CURLOPT_POST,1); |
|
| 94 | - curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
|
| 95 | - curl_setopt($curl,CURLOPT_TIMEOUT,20); |
|
| 96 | - curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
|
| 90 | + $curl = curl_init(); |
|
| 91 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
|
| 92 | + curl_setopt($curl, CURLOPT_URL, env('CHECK_LOGIN')); |
|
| 93 | + curl_setopt($curl, CURLOPT_POST, 1); |
|
| 94 | + curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); |
|
| 95 | + curl_setopt($curl, CURLOPT_TIMEOUT, 20); |
|
| 96 | + curl_setopt($curl, CURLOPT_HTTPHEADER, array( |
|
| 97 | 97 | 'Accept: application/json') |
| 98 | 98 | ); |
| 99 | - $exec=curl_exec($curl); |
|
| 99 | + $exec = curl_exec($curl); |
|
| 100 | 100 | |
| 101 | 101 | //dd($exec); |
| 102 | 102 | |
| 103 | - if(!$exec) |
|
| 103 | + if (!$exec) |
|
| 104 | 104 | { |
| 105 | 105 | return false; |
| 106 | 106 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | static function data() |
| 119 | 119 | { |
| 120 | - if( BantenprovSso::$result->status == false) |
|
| 120 | + if (BantenprovSso::$result->status == false) |
|
| 121 | 121 | { |
| 122 | 122 | return BantenprovSso::$result->message; |
| 123 | 123 | } |
@@ -129,18 +129,18 @@ discard block |
||
| 129 | 129 | { |
| 130 | 130 | $post['appid'] = env('APPID'); |
| 131 | 131 | $post['token'] = env('TOKEN'); |
| 132 | - $curl=curl_init(); |
|
| 133 | - curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); |
|
| 134 | - curl_setopt($curl,CURLOPT_URL,env('SSO_LOGOUT')); |
|
| 135 | - curl_setopt($curl,CURLOPT_POST,1); |
|
| 136 | - curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
|
| 137 | - curl_setopt($curl,CURLOPT_TIMEOUT,20); |
|
| 138 | - curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
|
| 132 | + $curl = curl_init(); |
|
| 133 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); |
|
| 134 | + curl_setopt($curl, CURLOPT_URL, env('SSO_LOGOUT')); |
|
| 135 | + curl_setopt($curl, CURLOPT_POST, 1); |
|
| 136 | + curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); |
|
| 137 | + curl_setopt($curl, CURLOPT_TIMEOUT, 20); |
|
| 138 | + curl_setopt($curl, CURLOPT_HTTPHEADER, array( |
|
| 139 | 139 | 'Accept: application/json') |
| 140 | 140 | ); |
| 141 | - $exec=curl_exec($curl); |
|
| 141 | + $exec = curl_exec($curl); |
|
| 142 | 142 | //dd($exec); |
| 143 | - if(!$exec) |
|
| 143 | + if (!$exec) |
|
| 144 | 144 | { |
| 145 | 145 | return false; |
| 146 | 146 | } |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | $ipaddress = ''; |
| 156 | 156 | if (getenv('HTTP_CLIENT_IP')) |
| 157 | 157 | $ipaddress = getenv('HTTP_CLIENT_IP'); |
| 158 | - else if(getenv('HTTP_X_FORWARDED_FOR')) |
|
| 158 | + else if (getenv('HTTP_X_FORWARDED_FOR')) |
|
| 159 | 159 | $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
| 160 | - else if(getenv('HTTP_X_FORWARDED')) |
|
| 160 | + else if (getenv('HTTP_X_FORWARDED')) |
|
| 161 | 161 | $ipaddress = getenv('HTTP_X_FORWARDED'); |
| 162 | - else if(getenv('HTTP_FORWARDED_FOR')) |
|
| 162 | + else if (getenv('HTTP_FORWARDED_FOR')) |
|
| 163 | 163 | $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
| 164 | - else if(getenv('HTTP_FORWARDED')) |
|
| 164 | + else if (getenv('HTTP_FORWARDED')) |
|
| 165 | 165 | $ipaddress = getenv('HTTP_FORWARDED'); |
| 166 | - else if(getenv('REMOTE_ADDR')) |
|
| 166 | + else if (getenv('REMOTE_ADDR')) |
|
| 167 | 167 | $ipaddress = getenv('REMOTE_ADDR'); |
| 168 | 168 | else |
| 169 | 169 | $ipaddress = 'UNKNOWN'; |