FindUserPwVerifyinputController.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Http\Controllers\Auth;
  3. use App\Events\PasswordRemindCreated;
  4. use App\Http\Controllers\Controller;
  5. use App\Services\CallApiService;
  6. class FindUserPwVerifyinputController extends Controller
  7. {
  8. private $callApiService;
  9. public function __construct(CallApiService $callApiService)
  10. {
  11. $this->callApiService = $callApiService;
  12. }
  13. public function emailVerifyinput()
  14. {
  15. $userPasswdEmail = $this->callApiService->callApi([
  16. 'url' => 'user-passwd-email',
  17. 'data' => [
  18. 'Email' => request('email')
  19. ]
  20. ]);
  21. if ($this->callApiService->verifyApiError($userPasswdEmail)) {
  22. return redirect()->back();
  23. }
  24. event(new PasswordRemindCreated([
  25. 'email' => request('email'),
  26. 'reset_code' => $userPasswdEmail['ResetCode'],
  27. 'route' => 'emails.auth.passwords-reset',
  28. 'redirectUrl' => 'user-password-change.index'
  29. ]));
  30. return redirect()->route('user-go-email');
  31. }
  32. }