bantenprov /
bantenprov-sso
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace App\Http\Controllers; |
||||||
| 4 | |||||||
| 5 | use Illuminate\Http\Request; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 6 | use Auth, Redirect, Validator; |
||||||
|
0 ignored issues
–
show
The type
Redirect was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
The type
Auth was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
The type
Validator was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 7 | use App\User; |
||||||
|
0 ignored issues
–
show
The type
App\User was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 8 | use Hash, Session; |
||||||
| 9 | use Bantenprov\BantenprovSso\BantenprovSso as BantenprovSso; |
||||||
| 10 | |||||||
| 11 | |||||||
| 12 | class DevelController extends Controller |
||||||
|
0 ignored issues
–
show
The type
App\Http\Controllers\Controller was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||||
| 13 | { |
||||||
| 14 | public function login() |
||||||
| 15 | { |
||||||
| 16 | if(!Auth::check()) |
||||||
| 17 | { |
||||||
| 18 | return view('pages.credential.login'); |
||||||
|
0 ignored issues
–
show
The function
view was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 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() |
||||||
|
0 ignored issues
–
show
The function
redirect was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 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')]); |
||||||
|
0 ignored issues
–
show
The function
Session was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 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); |
||||||
|
0 ignored issues
–
show
The method
App\Http\Controllers\DevelController::init_login() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 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'); |
||||||
|
0 ignored issues
–
show
The function
Session was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 145 | return 1; |
||||||
| 146 | } |
||||||
| 147 | |||||||
| 148 | public function logout() |
||||||
| 149 | { |
||||||
| 150 | Auth::logout(); |
||||||
| 151 | BantenprovSso::Logout(['ipaddress' => Session::get('ipaddress')]); |
||||||
| 152 | Session()->forget('ipaddress'); |
||||||
|
0 ignored issues
–
show
The function
Session was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 153 | return Redirect::to('/login'); |
||||||
| 154 | } |
||||||
| 155 | |||||||
| 156 | } |
||||||
| 157 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths