| @@ 16-51 (lines=36) @@ | ||
| 13 | * @author Ryan Thompson <[email protected]> |
|
| 14 | * @package Anomaly\UsersModule\User\Command |
|
| 15 | */ |
|
| 16 | class GetActivatePath implements SelfHandling |
|
| 17 | { |
|
| 18 | ||
| 19 | /** |
|
| 20 | * The user instance. |
|
| 21 | * |
|
| 22 | * @var UserInterface |
|
| 23 | */ |
|
| 24 | protected $user; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Create a new GetActivatePath instance. |
|
| 28 | * |
|
| 29 | * @param UserInterface $user |
|
| 30 | */ |
|
| 31 | public function __construct(UserInterface $user) |
|
| 32 | { |
|
| 33 | $this->user = $user; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * Handle the command. |
|
| 38 | * |
|
| 39 | * @param SettingRepositoryInterface $settings |
|
| 40 | * @return string|null |
|
| 41 | */ |
|
| 42 | public function handle(SettingRepositoryInterface $settings, Encrypter $encrypter) |
|
| 43 | { |
|
| 44 | $email = $encrypter->encrypt($this->user->getEmail()); |
|
| 45 | $code = $encrypter->encrypt($this->user->getActivationCode()); |
|
| 46 | ||
| 47 | $query = "?email={$email}&code={$code}"; |
|
| 48 | ||
| 49 | return $settings->value('anomaly.module.users::activate_path', 'register/activate') . $query; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| @@ 16-51 (lines=36) @@ | ||
| 13 | * @author Ryan Thompson <[email protected]> |
|
| 14 | * @package Anomaly\UsersModule\User\Command |
|
| 15 | */ |
|
| 16 | class GetCompleteResetPath implements SelfHandling |
|
| 17 | { |
|
| 18 | ||
| 19 | /** |
|
| 20 | * The user instance. |
|
| 21 | * |
|
| 22 | * @var UserInterface |
|
| 23 | */ |
|
| 24 | protected $user; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Create a new GetCompleteResetPath instance. |
|
| 28 | * |
|
| 29 | * @param UserInterface $user |
|
| 30 | */ |
|
| 31 | public function __construct(UserInterface $user) |
|
| 32 | { |
|
| 33 | $this->user = $user; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * Handle the command. |
|
| 38 | * |
|
| 39 | * @param SettingRepositoryInterface $settings |
|
| 40 | * @return string|null |
|
| 41 | */ |
|
| 42 | public function handle(SettingRepositoryInterface $settings, Encrypter $encrypter) |
|
| 43 | { |
|
| 44 | $email = $encrypter->encrypt($this->user->getEmail()); |
|
| 45 | $code = $encrypter->encrypt($this->user->getResetCode()); |
|
| 46 | ||
| 47 | $query = "?email={$email}&code={$code}"; |
|
| 48 | ||
| 49 | return $settings->value('anomaly.module.users::complete_reset_path', 'reset/complete') . $query; |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||