@@ 461-472 (lines=12) @@ | ||
458 | } |
|
459 | ||
460 | $user = Sentinel::findByCredentials([ 'email' => $email ]); |
|
461 | if (!$user) { |
|
462 | throw new \UnexpectedValueException('the user is not exists.', -10010); |
|
463 | } |
|
464 | else if ($user->invalid_flag === 1) { |
|
465 | throw new \UnexpectedValueException('the user has been disabled.', -10011); |
|
466 | } |
|
467 | else if ($user->directory && $user->directory != 'self') { |
|
468 | throw new \UnexpectedValueException('the user is external sync user.', -10012); |
|
469 | } |
|
470 | ||
471 | if ($email === '[email protected]') { |
|
472 | if (isset($user->bind_email) && $user->bind_email) { |
|
473 | $sendto_email = $user->bind_email; |
|
474 | $sections = explode('@', $user->bind_email); |
|
475 | $sections[0] = substr($sections[0], 0, 1) . '***' . substr($sections[0], -1, 1); |
|
@@ 584-595 (lines=12) @@ | ||
581 | ||
582 | $email = $reset_code->email; |
|
583 | $user = Sentinel::findByCredentials([ 'email' => $email ]); |
|
584 | if (!$user) { |
|
585 | throw new \UnexpectedValueException('the user is not exists.', -10010); |
|
586 | } |
|
587 | else if ($user->invalid_flag === 1) { |
|
588 | throw new \UnexpectedValueException('the user has been disabled.', -10011); |
|
589 | } |
|
590 | else if ($user->directory && $user->directory != 'self') { |
|
591 | throw new \UnexpectedValueException('the user is external sync user.', -10012); |
|
592 | } |
|
593 | ||
594 | return response()->json([ 'ecode' => 0, 'data' => [ 'email' => $reset_code['email'] ] ]); |
|
595 | } |
|
596 | ||
597 | /** |
|
598 | * reset the password. |
|
@@ 629-640 (lines=12) @@ | ||
626 | ||
627 | $email = $reset_code->email; |
|
628 | $user = Sentinel::findByCredentials([ 'email' => $email ]); |
|
629 | if (!$user) { |
|
630 | throw new \UnexpectedValueException('the user is not exsits.', -10010); |
|
631 | } |
|
632 | else if ($user->invalid_flag === 1) { |
|
633 | throw new \UnexpectedValueException('the user has been disabled.', -10011); |
|
634 | } |
|
635 | else if ($user->directory && $user->directory != 'self') { |
|
636 | throw new \UnexpectedValueException('the user is external sync user.', -10012); |
|
637 | } |
|
638 | ||
639 | $valid = Sentinel::validForUpdate($user, [ 'password' => $password ]); |
|
640 | if (!$valid) { |
|
641 | throw new \UnexpectedValueException('updating the user does fails.', -10107); |
|
642 | } |
|
643 |