-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f38614
commit c424c09
Showing
2,122 changed files
with
336,353 additions
and
16 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
app/Http/Controllers/Auth/AuthenticatedSessionController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Http\Requests\Auth\LoginRequest; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Laratrust; | ||
use App\Models\Mykj\ListPegawai2; | ||
use App\Models\User; | ||
|
||
class AuthenticatedSessionController extends Controller | ||
{ | ||
/** | ||
* Display the login view. | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function create() | ||
{ | ||
return view('main.auth.login'); | ||
} | ||
|
||
/** | ||
* Handle an incoming authentication request. | ||
* | ||
* @param \App\Http\Requests\Auth\LoginRequest $request | ||
* @return \Illuminate\Http\RedirectResponse | ||
*/ | ||
public function store(LoginRequest $request) | ||
{ | ||
$nokp = $request->input('nokp'); | ||
|
||
if($nokp != 111){ | ||
$getMaklumat = ListPegawai2::getMaklumatPegawai($nokp); | ||
|
||
if(empty($getMaklumat)){ | ||
return redirect('/login'); | ||
} | ||
|
||
try { | ||
User::createOrUpdate($getMaklumat); | ||
}catch (Exception $e){ | ||
return redirect('/login'); | ||
} | ||
} | ||
|
||
$request->authenticate(); | ||
|
||
$request->session()->regenerate(); | ||
|
||
if(Laratrust::hasRole('Admin')){ | ||
return redirect()->intended('/dashboard'); | ||
}else{ | ||
// if(Laratrust::hasRole('Pengguna')){ | ||
return redirect()->intended('/dashboard/pengguna'); | ||
// } | ||
} | ||
} | ||
|
||
/** | ||
* Destroy an authenticated session. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\RedirectResponse | ||
*/ | ||
public function destroy(Request $request) | ||
{ | ||
Auth::guard('web')->logout(); | ||
|
||
$request->session()->invalidate(); | ||
|
||
$request->session()->regenerateToken(); | ||
|
||
return redirect('/'); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
app/Http/Controllers/Auth/ConfirmablePasswordController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Validation\ValidationException; | ||
|
||
class ConfirmablePasswordController extends Controller | ||
{ | ||
/** | ||
* Show the confirm password view. | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function show() | ||
{ | ||
return view('auth.confirm-password'); | ||
} | ||
|
||
/** | ||
* Confirm the user's password. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return mixed | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
if (! Auth::guard('web')->validate([ | ||
'email' => $request->user()->email, | ||
'password' => $request->password, | ||
])) { | ||
throw ValidationException::withMessages([ | ||
'password' => __('auth.password'), | ||
]); | ||
} | ||
|
||
$request->session()->put('auth.password_confirmed_at', time()); | ||
|
||
return redirect()->intended(RouteServiceProvider::HOME); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
app/Http/Controllers/Auth/EmailVerificationNotificationController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Http\Request; | ||
|
||
class EmailVerificationNotificationController extends Controller | ||
{ | ||
/** | ||
* Send a new email verification notification. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\RedirectResponse | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
if ($request->user()->hasVerifiedEmail()) { | ||
return redirect()->intended(RouteServiceProvider::HOME); | ||
} | ||
|
||
$request->user()->sendEmailVerificationNotification(); | ||
|
||
return back()->with('status', 'verification-link-sent'); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/Http/Controllers/Auth/EmailVerificationPromptController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Http\Request; | ||
|
||
class EmailVerificationPromptController extends Controller | ||
{ | ||
/** | ||
* Display the email verification prompt. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return mixed | ||
*/ | ||
public function __invoke(Request $request) | ||
{ | ||
return $request->user()->hasVerifiedEmail() | ||
? redirect()->intended(RouteServiceProvider::HOME) | ||
: view('auth.verify-email'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Auth\Events\PasswordReset; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Hash; | ||
use Illuminate\Support\Facades\Password; | ||
use Illuminate\Support\Str; | ||
use Illuminate\Validation\Rules; | ||
|
||
class NewPasswordController extends Controller | ||
{ | ||
/** | ||
* Display the password reset view. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function create(Request $request) | ||
{ | ||
return view('auth.reset-password', ['request' => $request]); | ||
} | ||
|
||
/** | ||
* Handle an incoming new password request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\RedirectResponse | ||
* | ||
* @throws \Illuminate\Validation\ValidationException | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
$request->validate([ | ||
'token' => ['required'], | ||
'email' => ['required', 'email'], | ||
'password' => ['required', 'confirmed', Rules\Password::defaults()], | ||
]); | ||
|
||
// Here we will attempt to reset the user's password. If it is successful we | ||
// will update the password on an actual user model and persist it to the | ||
// database. Otherwise we will parse the error and return the response. | ||
$status = Password::reset( | ||
$request->only('email', 'password', 'password_confirmation', 'token'), | ||
function ($user) use ($request) { | ||
$user->forceFill([ | ||
'password' => Hash::make($request->password), | ||
'remember_token' => Str::random(60), | ||
])->save(); | ||
|
||
event(new PasswordReset($user)); | ||
} | ||
); | ||
|
||
// If the password was successfully reset, we will redirect the user back to | ||
// the application's home authenticated view. If there is an error we can | ||
// redirect them back to where they came from with their error message. | ||
return $status == Password::PASSWORD_RESET | ||
? redirect()->route('login')->with('status', __($status)) | ||
: back()->withInput($request->only('email')) | ||
->withErrors(['email' => __($status)]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Password; | ||
|
||
class PasswordResetLinkController extends Controller | ||
{ | ||
/** | ||
* Display the password reset link request view. | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function create() | ||
{ | ||
return view('auth.forgot-password'); | ||
} | ||
|
||
/** | ||
* Handle an incoming password reset link request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\RedirectResponse | ||
* | ||
* @throws \Illuminate\Validation\ValidationException | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
$request->validate([ | ||
'email' => ['required', 'email'], | ||
]); | ||
|
||
// We will send the password reset link to this user. Once we have attempted | ||
// to send the link, we will examine the response then see the message we | ||
// need to show to the user. Finally, we'll send out a proper response. | ||
$status = Password::sendResetLink( | ||
$request->only('email') | ||
); | ||
|
||
return $status == Password::RESET_LINK_SENT | ||
? back()->with('status', __($status)) | ||
: back()->withInput($request->only('email')) | ||
->withErrors(['email' => __($status)]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Models\User; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Auth\Events\Registered; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Hash; | ||
use Illuminate\Validation\Rules; | ||
|
||
class RegisteredUserController extends Controller | ||
{ | ||
/** | ||
* Display the registration view. | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function create() | ||
{ | ||
return view('auth.register'); | ||
} | ||
|
||
/** | ||
* Handle an incoming registration request. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return \Illuminate\Http\RedirectResponse | ||
* | ||
* @throws \Illuminate\Validation\ValidationException | ||
*/ | ||
public function store(Request $request) | ||
{ | ||
$request->validate([ | ||
'name' => ['required', 'string', 'max:255'], | ||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], | ||
'password' => ['required', 'confirmed', Rules\Password::defaults()], | ||
]); | ||
|
||
$user = User::create([ | ||
'name' => $request->name, | ||
'email' => $request->email, | ||
'password' => Hash::make($request->password), | ||
]); | ||
|
||
event(new Registered($user)); | ||
|
||
Auth::login($user); | ||
|
||
return redirect(RouteServiceProvider::HOME); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Auth; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Providers\RouteServiceProvider; | ||
use Illuminate\Auth\Events\Verified; | ||
use Illuminate\Foundation\Auth\EmailVerificationRequest; | ||
|
||
class VerifyEmailController extends Controller | ||
{ | ||
/** | ||
* Mark the authenticated user's email address as verified. | ||
* | ||
* @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request | ||
* @return \Illuminate\Http\RedirectResponse | ||
*/ | ||
public function __invoke(EmailVerificationRequest $request) | ||
{ | ||
if ($request->user()->hasVerifiedEmail()) { | ||
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); | ||
} | ||
|
||
if ($request->user()->markEmailAsVerified()) { | ||
event(new Verified($request->user())); | ||
} | ||
|
||
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); | ||
} | ||
} |
Oops, something went wrong.