@@ -6,28 +6,28 @@ |
||
| 6 | 6 | |
| 7 | 7 | class BantenprovSsoServiceProvider extends ServiceProvider |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Bootstrap the application services. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function boot() |
|
| 15 | - { |
|
| 16 | - include __DIR__.'/BantenprovSso.php'; |
|
| 17 | - $this->publishes([ |
|
| 18 | - __DIR__ . '/views' => base_path('public/js'), |
|
| 19 | - __DIR__ . '/controllers' => base_path('app/Http/Controllers'), |
|
| 20 | - ]); |
|
| 21 | - $this->commands('Bantenprov\BantenprovSso\Commands\RouteCommands'); |
|
| 22 | - } |
|
| 9 | + /** |
|
| 10 | + * Bootstrap the application services. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function boot() |
|
| 15 | + { |
|
| 16 | + include __DIR__.'/BantenprovSso.php'; |
|
| 17 | + $this->publishes([ |
|
| 18 | + __DIR__ . '/views' => base_path('public/js'), |
|
| 19 | + __DIR__ . '/controllers' => base_path('app/Http/Controllers'), |
|
| 20 | + ]); |
|
| 21 | + $this->commands('Bantenprov\BantenprovSso\Commands\RouteCommands'); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Register the application services. |
|
| 26 | - * |
|
| 27 | - * @return void |
|
| 28 | - */ |
|
| 29 | - public function register() |
|
| 30 | - { |
|
| 31 | - // |
|
| 32 | - } |
|
| 24 | + /** |
|
| 25 | + * Register the application services. |
|
| 26 | + * |
|
| 27 | + * @return void |
|
| 28 | + */ |
|
| 29 | + public function register() |
|
| 30 | + { |
|
| 31 | + // |
|
| 32 | + } |
|
| 33 | 33 | } |
@@ -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 | } |
@@ -11,146 +11,146 @@ |
||
| 11 | 11 | |
| 12 | 12 | class DevelController extends Controller |
| 13 | 13 | { |
| 14 | - public function login() |
|
| 15 | - { |
|
| 16 | - if(!Auth::check()) |
|
| 17 | - { |
|
| 18 | - return view('pages.credential.login'); |
|
| 19 | - } |
|
| 20 | - return Redirect::to('dashboard'); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function post_login(Request $request) |
|
| 24 | - { |
|
| 25 | - $validator = Validator::make($request->all(), |
|
| 26 | - [ |
|
| 27 | - 'email' => 'required|email', |
|
| 28 | - 'password' => 'required' |
|
| 29 | - ]); |
|
| 30 | - |
|
| 31 | - if($validator->fails()) |
|
| 32 | - { |
|
| 33 | - Session::flash('message', 'Data tidak boleh kosong'); |
|
| 34 | - return redirect()->back() |
|
| 35 | - ->withErrors($validator) |
|
| 36 | - ->withInput(); |
|
| 37 | - } |
|
| 38 | - $credential = [ |
|
| 39 | - 'email' => $request->input('email'), |
|
| 40 | - 'password' => $request->input('password'), |
|
| 41 | - 'ipaddress' => $request->input('ip1').'-'.$request->input('ip2') |
|
| 42 | - ]; |
|
| 43 | - |
|
| 44 | - //set session |
|
| 45 | - Session(['ipaddress' => $request->input('ip1').'-'.$request->input('ip2')]); |
|
| 46 | - |
|
| 47 | - if(!BantenprovSso::Attempt($credential)) |
|
| 48 | - { |
|
| 49 | - //dd(BantenprovSso::message()); |
|
| 50 | - Session::flash('message', 'terjadi kesalah, login tidak berhasil'); |
|
| 51 | - return redirect()->back() |
|
| 52 | - ->withErrors(BantenprovSso::message()) |
|
| 53 | - ->withInput(); |
|
| 54 | - } |
|
| 55 | - //dd(BantenprovSso::data()); |
|
| 56 | - $data = BantenprovSso::data(); |
|
| 57 | - //check data user pada table user |
|
| 58 | - $user = User::where('email', $data->email) |
|
| 59 | - ->first(); |
|
| 60 | - if(count($user) == 0) |
|
| 61 | - { |
|
| 62 | - //return 'gak ada'; |
|
| 63 | - //insert data user |
|
| 64 | - $create_user = new User; |
|
| 65 | - $create_user->email = $data->email; |
|
| 66 | - $create_user->name = $data->name; |
|
| 67 | - $create_user->password = $data->password; |
|
| 68 | - $create_user->save(); |
|
| 69 | - |
|
| 70 | - return Self::init_login($create_user); |
|
| 71 | - } |
|
| 72 | - else |
|
| 73 | - { |
|
| 74 | - return Self::init_login($user); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - public function init_login($data) |
|
| 80 | - { |
|
| 81 | - //login with id |
|
| 82 | - //dd($data->id); |
|
| 83 | - if(Auth::loginUsingId($data->id)) |
|
| 84 | - { |
|
| 85 | - return redirect::to('dashboard'); |
|
| 86 | - |
|
| 87 | - } |
|
| 88 | - else |
|
| 89 | - { |
|
| 90 | - //false |
|
| 91 | - return Redirect::to('login'); |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - public function check_logout(Request $request) |
|
| 98 | - { |
|
| 99 | - if(BantenprovSso::check_logout(['ipaddress' => $request->input('ipaddress')])) |
|
| 100 | - { |
|
| 101 | - return 1; |
|
| 102 | - } |
|
| 103 | - else |
|
| 104 | - { |
|
| 105 | - return 0; |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - public function check_login(Request $request) |
|
| 110 | - { |
|
| 111 | - $check = BantenprovSso::check_login(['ipaddress' => $request->input('ipaddress')]); |
|
| 112 | - if(!$check) |
|
| 113 | - { |
|
| 114 | - return 0; |
|
| 115 | - } |
|
| 116 | - else |
|
| 117 | - { |
|
| 118 | - // cari atau simpan data baru |
|
| 119 | - $teng = BantenprovSso::check_login_data(); |
|
| 120 | - $user_data = User::where('email', $teng->email)->first(); |
|
| 121 | - if(count($user_data) == 0) |
|
| 122 | - { |
|
| 123 | - //simpan data baru |
|
| 124 | - $simpan = new User; |
|
| 125 | - $simpan->email = $teng->email; |
|
| 126 | - $simpan->name = $teng->name; |
|
| 127 | - $simpan->password = 'bantenprov'; |
|
| 128 | - $simpan->save(); |
|
| 129 | - |
|
| 130 | - Auth::loginUsingId($simpan->id); |
|
| 131 | - return 1; |
|
| 132 | - } |
|
| 133 | - else |
|
| 134 | - { |
|
| 135 | - Auth::loginUsingId($user_data->id); |
|
| 136 | - return 1; |
|
| 137 | - } |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - public function cas_logout() |
|
| 142 | - { |
|
| 143 | - Auth::logout(); |
|
| 144 | - Session()->forget('ipaddress'); |
|
| 145 | - return 1; |
|
| 146 | - } |
|
| 14 | + public function login() |
|
| 15 | + { |
|
| 16 | + if(!Auth::check()) |
|
| 17 | + { |
|
| 18 | + return view('pages.credential.login'); |
|
| 19 | + } |
|
| 20 | + return Redirect::to('dashboard'); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function post_login(Request $request) |
|
| 24 | + { |
|
| 25 | + $validator = Validator::make($request->all(), |
|
| 26 | + [ |
|
| 27 | + 'email' => 'required|email', |
|
| 28 | + 'password' => 'required' |
|
| 29 | + ]); |
|
| 30 | + |
|
| 31 | + if($validator->fails()) |
|
| 32 | + { |
|
| 33 | + Session::flash('message', 'Data tidak boleh kosong'); |
|
| 34 | + return redirect()->back() |
|
| 35 | + ->withErrors($validator) |
|
| 36 | + ->withInput(); |
|
| 37 | + } |
|
| 38 | + $credential = [ |
|
| 39 | + 'email' => $request->input('email'), |
|
| 40 | + 'password' => $request->input('password'), |
|
| 41 | + 'ipaddress' => $request->input('ip1').'-'.$request->input('ip2') |
|
| 42 | + ]; |
|
| 43 | + |
|
| 44 | + //set session |
|
| 45 | + Session(['ipaddress' => $request->input('ip1').'-'.$request->input('ip2')]); |
|
| 46 | + |
|
| 47 | + if(!BantenprovSso::Attempt($credential)) |
|
| 48 | + { |
|
| 49 | + //dd(BantenprovSso::message()); |
|
| 50 | + Session::flash('message', 'terjadi kesalah, login tidak berhasil'); |
|
| 51 | + return redirect()->back() |
|
| 52 | + ->withErrors(BantenprovSso::message()) |
|
| 53 | + ->withInput(); |
|
| 54 | + } |
|
| 55 | + //dd(BantenprovSso::data()); |
|
| 56 | + $data = BantenprovSso::data(); |
|
| 57 | + //check data user pada table user |
|
| 58 | + $user = User::where('email', $data->email) |
|
| 59 | + ->first(); |
|
| 60 | + if(count($user) == 0) |
|
| 61 | + { |
|
| 62 | + //return 'gak ada'; |
|
| 63 | + //insert data user |
|
| 64 | + $create_user = new User; |
|
| 65 | + $create_user->email = $data->email; |
|
| 66 | + $create_user->name = $data->name; |
|
| 67 | + $create_user->password = $data->password; |
|
| 68 | + $create_user->save(); |
|
| 69 | + |
|
| 70 | + return Self::init_login($create_user); |
|
| 71 | + } |
|
| 72 | + else |
|
| 73 | + { |
|
| 74 | + return Self::init_login($user); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + public function init_login($data) |
|
| 80 | + { |
|
| 81 | + //login with id |
|
| 82 | + //dd($data->id); |
|
| 83 | + if(Auth::loginUsingId($data->id)) |
|
| 84 | + { |
|
| 85 | + return redirect::to('dashboard'); |
|
| 86 | + |
|
| 87 | + } |
|
| 88 | + else |
|
| 89 | + { |
|
| 90 | + //false |
|
| 91 | + return Redirect::to('login'); |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + public function check_logout(Request $request) |
|
| 98 | + { |
|
| 99 | + if(BantenprovSso::check_logout(['ipaddress' => $request->input('ipaddress')])) |
|
| 100 | + { |
|
| 101 | + return 1; |
|
| 102 | + } |
|
| 103 | + else |
|
| 104 | + { |
|
| 105 | + return 0; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + public function check_login(Request $request) |
|
| 110 | + { |
|
| 111 | + $check = BantenprovSso::check_login(['ipaddress' => $request->input('ipaddress')]); |
|
| 112 | + if(!$check) |
|
| 113 | + { |
|
| 114 | + return 0; |
|
| 115 | + } |
|
| 116 | + else |
|
| 117 | + { |
|
| 118 | + // cari atau simpan data baru |
|
| 119 | + $teng = BantenprovSso::check_login_data(); |
|
| 120 | + $user_data = User::where('email', $teng->email)->first(); |
|
| 121 | + if(count($user_data) == 0) |
|
| 122 | + { |
|
| 123 | + //simpan data baru |
|
| 124 | + $simpan = new User; |
|
| 125 | + $simpan->email = $teng->email; |
|
| 126 | + $simpan->name = $teng->name; |
|
| 127 | + $simpan->password = 'bantenprov'; |
|
| 128 | + $simpan->save(); |
|
| 129 | + |
|
| 130 | + Auth::loginUsingId($simpan->id); |
|
| 131 | + return 1; |
|
| 132 | + } |
|
| 133 | + else |
|
| 134 | + { |
|
| 135 | + Auth::loginUsingId($user_data->id); |
|
| 136 | + return 1; |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + public function cas_logout() |
|
| 142 | + { |
|
| 143 | + Auth::logout(); |
|
| 144 | + Session()->forget('ipaddress'); |
|
| 145 | + return 1; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | 148 | public function logout() |
| 149 | - { |
|
| 150 | - Auth::logout(); |
|
| 151 | - BantenprovSso::Logout(['ipaddress' => Session::get('ipaddress')]); |
|
| 152 | - Session()->forget('ipaddress'); |
|
| 153 | - return Redirect::to('/login'); |
|
| 154 | - } |
|
| 149 | + { |
|
| 150 | + Auth::logout(); |
|
| 151 | + BantenprovSso::Logout(['ipaddress' => Session::get('ipaddress')]); |
|
| 152 | + Session()->forget('ipaddress'); |
|
| 153 | + return Redirect::to('/login'); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | 156 | } |
@@ -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); |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | $create_user->save(); |
| 69 | 69 | |
| 70 | 70 | return Self::init_login($create_user); |
| 71 | - } |
|
| 72 | - else |
|
| 71 | + } else |
|
| 73 | 72 | { |
| 74 | 73 | return Self::init_login($user); |
| 75 | 74 | } |
@@ -84,8 +83,7 @@ discard block |
||
| 84 | 83 | { |
| 85 | 84 | return redirect::to('dashboard'); |
| 86 | 85 | |
| 87 | - } |
|
| 88 | - else |
|
| 86 | + } else |
|
| 89 | 87 | { |
| 90 | 88 | //false |
| 91 | 89 | return Redirect::to('login'); |
@@ -99,8 +97,7 @@ discard block |
||
| 99 | 97 | if(BantenprovSso::check_logout(['ipaddress' => $request->input('ipaddress')])) |
| 100 | 98 | { |
| 101 | 99 | return 1; |
| 102 | - } |
|
| 103 | - else |
|
| 100 | + } else |
|
| 104 | 101 | { |
| 105 | 102 | return 0; |
| 106 | 103 | } |
@@ -112,8 +109,7 @@ discard block |
||
| 112 | 109 | if(!$check) |
| 113 | 110 | { |
| 114 | 111 | return 0; |
| 115 | - } |
|
| 116 | - else |
|
| 112 | + } else |
|
| 117 | 113 | { |
| 118 | 114 | // cari atau simpan data baru |
| 119 | 115 | $teng = BantenprovSso::check_login_data(); |
@@ -129,8 +125,7 @@ discard block |
||
| 129 | 125 | |
| 130 | 126 | Auth::loginUsingId($simpan->id); |
| 131 | 127 | return 1; |
| 132 | - } |
|
| 133 | - else |
|
| 128 | + } else |
|
| 134 | 129 | { |
| 135 | 130 | Auth::loginUsingId($user_data->id); |
| 136 | 131 | return 1; |
@@ -17,51 +17,51 @@ |
||
| 17 | 17 | |
| 18 | 18 | class RouteCommands extends Command |
| 19 | 19 | { |
| 20 | - /** |
|
| 21 | - * The name and signature of the console command. |
|
| 22 | - * |
|
| 23 | - * @var string |
|
| 24 | - */ |
|
| 25 | - protected $signature = 'bantenprov-sso:add-route'; |
|
| 20 | + /** |
|
| 21 | + * The name and signature of the console command. |
|
| 22 | + * |
|
| 23 | + * @var string |
|
| 24 | + */ |
|
| 25 | + protected $signature = 'bantenprov-sso:add-route'; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * The console command description. |
|
| 29 | - * |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 32 | - protected $description = 'Add sso rotes to web route'; |
|
| 27 | + /** |
|
| 28 | + * The console command description. |
|
| 29 | + * |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | + protected $description = 'Add sso rotes to web route'; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Create a new command instance. |
|
| 36 | - * |
|
| 37 | - * @return void |
|
| 38 | - */ |
|
| 34 | + /** |
|
| 35 | + * Create a new command instance. |
|
| 36 | + * |
|
| 37 | + * @return void |
|
| 38 | + */ |
|
| 39 | 39 | |
| 40 | - protected $drip; |
|
| 40 | + protected $drip; |
|
| 41 | 41 | |
| 42 | - public function __construct() |
|
| 43 | - { |
|
| 44 | - parent::__construct(); |
|
| 42 | + public function __construct() |
|
| 43 | + { |
|
| 44 | + parent::__construct(); |
|
| 45 | 45 | |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Execute the console command. |
|
| 50 | - * |
|
| 51 | - * @return mixed |
|
| 52 | - */ |
|
| 48 | + /** |
|
| 49 | + * Execute the console command. |
|
| 50 | + * |
|
| 51 | + * @return mixed |
|
| 52 | + */ |
|
| 53 | 53 | |
| 54 | - protected function content() |
|
| 55 | - { |
|
| 54 | + protected function content() |
|
| 55 | + { |
|
| 56 | 56 | |
| 57 | - $replace_middleware = File::get(__DIR__.'/../stubs/route.stub'); |
|
| 58 | - return $replace_middleware; |
|
| 59 | - } |
|
| 57 | + $replace_middleware = File::get(__DIR__.'/../stubs/route.stub'); |
|
| 58 | + return $replace_middleware; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - public function handle() |
|
| 63 | - { |
|
| 64 | - $this->info('Route add success'); |
|
| 65 | - File::append(base_path('routes/web.php'),"\n".$this->content()); |
|
| 66 | - } |
|
| 62 | + public function handle() |
|
| 63 | + { |
|
| 64 | + $this->info('Route add success'); |
|
| 65 | + File::append(base_path('routes/web.php'),"\n".$this->content()); |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -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 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
| 43 | 43 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
| 44 | 44 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
| 45 | - 'Accept: application/json') |
|
| 45 | + 'Accept: application/json') |
|
| 46 | 46 | ); |
| 47 | 47 | $exec=curl_exec($curl); |
| 48 | 48 | if(!$exec) |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
| 72 | 72 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
| 73 | 73 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
| 74 | - 'Accept: application/json') |
|
| 74 | + 'Accept: application/json') |
|
| 75 | 75 | ); |
| 76 | 76 | $exec=curl_exec($curl); |
| 77 | 77 | if(!$exec) |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
| 95 | 95 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
| 96 | 96 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
| 97 | - 'Accept: application/json') |
|
| 97 | + 'Accept: application/json') |
|
| 98 | 98 | ); |
| 99 | 99 | $exec=curl_exec($curl); |
| 100 | 100 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | curl_setopt($curl,CURLOPT_POSTFIELDS,http_build_query($post)); |
| 137 | 137 | curl_setopt($curl,CURLOPT_TIMEOUT,20); |
| 138 | 138 | curl_setopt($curl,CURLOPT_HTTPHEADER, array( |
| 139 | - 'Accept: application/json') |
|
| 139 | + 'Accept: application/json') |
|
| 140 | 140 | ); |
| 141 | 141 | $exec=curl_exec($curl); |
| 142 | 142 | //dd($exec); |
@@ -153,21 +153,21 @@ discard block |
||
| 153 | 153 | static function InitAddress() |
| 154 | 154 | { |
| 155 | 155 | $ipaddress = ''; |
| 156 | - if (getenv('HTTP_CLIENT_IP')) |
|
| 157 | - $ipaddress = getenv('HTTP_CLIENT_IP'); |
|
| 158 | - else if(getenv('HTTP_X_FORWARDED_FOR')) |
|
| 159 | - $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
|
| 160 | - else if(getenv('HTTP_X_FORWARDED')) |
|
| 161 | - $ipaddress = getenv('HTTP_X_FORWARDED'); |
|
| 162 | - else if(getenv('HTTP_FORWARDED_FOR')) |
|
| 163 | - $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
|
| 164 | - else if(getenv('HTTP_FORWARDED')) |
|
| 165 | - $ipaddress = getenv('HTTP_FORWARDED'); |
|
| 166 | - else if(getenv('REMOTE_ADDR')) |
|
| 167 | - $ipaddress = getenv('REMOTE_ADDR'); |
|
| 168 | - else |
|
| 169 | - $ipaddress = 'UNKNOWN'; |
|
| 170 | - return $ipaddress; |
|
| 156 | + if (getenv('HTTP_CLIENT_IP')) |
|
| 157 | + $ipaddress = getenv('HTTP_CLIENT_IP'); |
|
| 158 | + else if(getenv('HTTP_X_FORWARDED_FOR')) |
|
| 159 | + $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
|
| 160 | + else if(getenv('HTTP_X_FORWARDED')) |
|
| 161 | + $ipaddress = getenv('HTTP_X_FORWARDED'); |
|
| 162 | + else if(getenv('HTTP_FORWARDED_FOR')) |
|
| 163 | + $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
|
| 164 | + else if(getenv('HTTP_FORWARDED')) |
|
| 165 | + $ipaddress = getenv('HTTP_FORWARDED'); |
|
| 166 | + else if(getenv('REMOTE_ADDR')) |
|
| 167 | + $ipaddress = getenv('REMOTE_ADDR'); |
|
| 168 | + else |
|
| 169 | + $ipaddress = 'UNKNOWN'; |
|
| 170 | + return $ipaddress; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | static function init() |
@@ -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'; |
@@ -153,20 +153,21 @@ |
||
| 153 | 153 | static function InitAddress() |
| 154 | 154 | { |
| 155 | 155 | $ipaddress = ''; |
| 156 | - if (getenv('HTTP_CLIENT_IP')) |
|
| 157 | - $ipaddress = getenv('HTTP_CLIENT_IP'); |
|
| 158 | - else if(getenv('HTTP_X_FORWARDED_FOR')) |
|
| 159 | - $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
|
| 160 | - else if(getenv('HTTP_X_FORWARDED')) |
|
| 161 | - $ipaddress = getenv('HTTP_X_FORWARDED'); |
|
| 162 | - else if(getenv('HTTP_FORWARDED_FOR')) |
|
| 163 | - $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
|
| 164 | - else if(getenv('HTTP_FORWARDED')) |
|
| 165 | - $ipaddress = getenv('HTTP_FORWARDED'); |
|
| 166 | - else if(getenv('REMOTE_ADDR')) |
|
| 167 | - $ipaddress = getenv('REMOTE_ADDR'); |
|
| 168 | - else |
|
| 169 | - $ipaddress = 'UNKNOWN'; |
|
| 156 | + if (getenv('HTTP_CLIENT_IP')) { |
|
| 157 | + $ipaddress = getenv('HTTP_CLIENT_IP'); |
|
| 158 | + } else if(getenv('HTTP_X_FORWARDED_FOR')) { |
|
| 159 | + $ipaddress = getenv('HTTP_X_FORWARDED_FOR'); |
|
| 160 | + } else if(getenv('HTTP_X_FORWARDED')) { |
|
| 161 | + $ipaddress = getenv('HTTP_X_FORWARDED'); |
|
| 162 | + } else if(getenv('HTTP_FORWARDED_FOR')) { |
|
| 163 | + $ipaddress = getenv('HTTP_FORWARDED_FOR'); |
|
| 164 | + } else if(getenv('HTTP_FORWARDED')) { |
|
| 165 | + $ipaddress = getenv('HTTP_FORWARDED'); |
|
| 166 | + } else if(getenv('REMOTE_ADDR')) { |
|
| 167 | + $ipaddress = getenv('REMOTE_ADDR'); |
|
| 168 | + } else { |
|
| 169 | + $ipaddress = 'UNKNOWN'; |
|
| 170 | + } |
|
| 170 | 171 | return $ipaddress; |
| 171 | 172 | } |
| 172 | 173 | |