Completed
Push — master ( 54f2ec...c5e082 )
by Ryan
02:52
created

ResetPasswordFormCriteria::onInitialized()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 3
eloc 5
nc 4
nop 2
1
<?php namespace Anomaly\UsersModule\User\Password;
2
3
use Anomaly\Streams\Platform\Ui\Form\FormCriteria;
4
use Illuminate\Contracts\Cache\Repository;
5
use Illuminate\Contracts\Encryption\Encrypter;
6
use Illuminate\Http\Request;
7
8
/**
9
 * Class ResetPasswordFormCriteria
10
 *
11
 * @link          http://pyrocms.com/
12
 * @author        PyroCMS, Inc. <[email protected]>
13
 * @author        Ryan Thompson <[email protected]>
14
 * @package       Anomaly\UsersModule\User\Password
15
 */
16
class ResetPasswordFormCriteria extends FormCriteria
17
{
18
19
    /**
20
     * Fired just before building.
21
     *
22
     * @param Encrypter $encrypter
23
     * @param Request   $request
24
     */
25
    public function onInitialized(Encrypter $encrypter, Request $request)
26
    {
27
        if ($code = $request->get('code')) {
28
            array_set($this->parameters, 'code', $encrypter->decrypt($code));
29
        }
30
31
        if ($email = $request->get('email')) {
32
            array_set($this->parameters, 'email', $encrypter->decrypt($email));
33
        }
34
    }
35
}
36