123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Http\Controllers\Auth;
- use App\Http\Controllers\Controller;
- use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
- use Illuminate\Support\Facades\Password;
- use Illuminate\Http\Request;
- use App\User;
- class ForgotPasswordController extends Controller
- {
- /*
- |--------------------------------------------------------------------------
- | Password Reset Controller
- |--------------------------------------------------------------------------
- |
- | This controller is responsible for handling password reset emails and
- | includes a trait which assists in sending these notifications from
- | your application to your users. Feel free to explore this trait.
- |
- */
- use SendsPasswordResetEmails;
- public function __construct()
- {
- $this->middleware('guest');
- }
- public function showLinkRequestForm()
- {
- return view('auth.passwords.email');
- }
- public function broker()
- {
- return Password::broker('users');
- }
- public function sendResetLinkEmail(Request $request){
- $request->validate([
- 'email'=>'required|email|exists:users'
- ]);
- $applicant= User::where('email', $request->email)->first();
- if (empty($applicant)) {
- return back()->with('error','Unknown Email address!');
- }
- if($applicant->email_verification == 0){
- return back()->with('error', 'Your e-mail is not verified!. Please check your email');
- }else{
- \Mail::to(
- $request->email
- )->send(
- new \App\Mail\ApplicantPasswordResetLink($applicant)
- );
- return back()->with('success', 'Your password reset link sent to registered emails inbox.');
- }
-
- }
- }
|