diff --git a/packages/Auth/SendsPasswordResetEmails.php b/packages/Auth/SendsPasswordResetEmails.php index 71aeaf02..dc7be86a 100644 --- a/packages/Auth/SendsPasswordResetEmails.php +++ b/packages/Auth/SendsPasswordResetEmails.php @@ -7,6 +7,7 @@ use App\Models\User; use App\Services\Notification\SmsNotification; use Carbon\Carbon; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; use Packages\Messaging\src\Facades\MessageResponse; // use Packages\SMSSender\SMSSender; @@ -22,7 +23,7 @@ trait SendsPasswordResetEmails public function sendDisposablePassword(Request $request) { $this->validatePhone($request); - + // We will send the Disposable Password // to send the Disposable Password , we will examine the response then see the message we // need to show to the user. Finally, we'll send out a proper response. @@ -42,11 +43,9 @@ trait SendsPasswordResetEmails if ( !is_null($userid) ) { $user = User::findOrFail($userid); if($user) { - $user->password = \Hash::make($request->code); - $user->save(); - - $request->merge([ 'cell_number' => $user->cell_number, 'password' => $request->code ]); - return (new LoginController())->login($request); + Auth::login($user); + $token = $user->createToken('auth-token')->accessToken; + return MessageResponse::success('logged in successfully','verify password',$token); } return MessageResponse::error('User Not Found'); }