|
1
|
|
|
<?php namespace Anomaly\UsersModule\User\Command; |
|
2
|
|
|
|
|
3
|
|
|
use Anomaly\Streams\Platform\Addon\Plugin\PluginForm; |
|
4
|
|
|
use Anomaly\Streams\Platform\Support\Decorator; |
|
5
|
|
|
use Anomaly\UsersModule\User\Reset\CompleteResetFormBuilder; |
|
6
|
|
|
use Illuminate\Contracts\Bus\SelfHandling; |
|
7
|
|
|
use Illuminate\Contracts\Encryption\Encrypter; |
|
8
|
|
|
use Illuminate\Http\Request; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class BuildCompleteResetForm |
|
12
|
|
|
* |
|
13
|
|
|
* @link http://anomaly.is/streams-platform |
|
14
|
|
|
* @author AnomalyLabs, Inc. <[email protected]> |
|
15
|
|
|
* @author Ryan Thompson <[email protected]> |
|
16
|
|
|
* @package Anomaly\UsersModule\User\Command |
|
17
|
|
|
*/ |
|
18
|
|
|
class BuildCompleteResetForm implements SelfHandling |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* The form parameters. |
|
23
|
|
|
* |
|
24
|
|
|
* @var array |
|
25
|
|
|
*/ |
|
26
|
|
|
protected $parameters; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Create a new BuildCompleteResetForm instance. |
|
30
|
|
|
* |
|
31
|
|
|
* @param array $parameters |
|
32
|
|
|
*/ |
|
33
|
|
|
public function __construct(array $parameters = []) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->parameters = $parameters; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Handle the command. |
|
40
|
|
|
* |
|
41
|
|
|
* @param PluginForm $form |
|
42
|
|
|
* @param Request $request |
|
43
|
|
|
* @param Encrypter $encrypter |
|
44
|
|
|
* @param Decorator $decorator |
|
45
|
|
|
* @return \Anomaly\Streams\Platform\Ui\Form\FormBuilder |
|
46
|
|
|
*/ |
|
47
|
|
|
public function handle(PluginForm $form, Request $request, Encrypter $encrypter, Decorator $decorator) |
|
48
|
|
|
{ |
|
49
|
|
|
$code = $encrypter->decrypt($request->get('code')); |
|
50
|
|
|
$email = $encrypter->decrypt($request->get('email')); |
|
51
|
|
|
|
|
52
|
|
|
$parameters = array_merge_recursive( |
|
53
|
|
|
$this->parameters, |
|
54
|
|
|
[ |
|
55
|
|
|
'code' => $code, |
|
56
|
|
|
'email' => $email, |
|
57
|
|
|
'builder' => CompleteResetFormBuilder::class |
|
58
|
|
|
] |
|
59
|
|
|
); |
|
60
|
|
|
|
|
61
|
|
|
return $decorator->decorate($form->make($parameters)->getForm()); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|