Completed
Pull Request — master (#9)
by ARCANEDEV
04:02
created

PasswordResetRoutes::getRouteAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
1
<?php namespace Arcanesoft\Auth\Http\Routes\Front;
2
3
use Arcanedev\Support\Bases\RouteRegister;
4
use Illuminate\Contracts\Routing\Registrar;
5
6
/**
7
 * Class     PasswordResetRoutes
8
 *
9
 * @package  Arcanesoft\Auth\Http\Routes\Front
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class PasswordResetRoutes extends RouteRegister
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Main Functions
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * Map routes.
20
     *
21
     * @param  \Illuminate\Contracts\Routing\Registrar  $router
22
     */
23
    public function map(Registrar $router)
24
    {
25
        if ($this->isEnabled()) {
26
            $this->group($this->getRouteAttributes(), function () {
27
                $this->get('reset', [
28
                    'as'   => 'get',   // auth::password.get
29
                    'uses' => 'ForgotPasswordController@showLinkRequestForm'
30
                ]);
31
32
                $this->post('email', [
33
                    'as'   => 'email', // auth::password.email
34
                    'uses' => 'ForgotPasswordController@sendResetLinkEmail'
35
                ]);
36
37
                $this->get('reset/{token}', [
38
                    'as'   => 'token', // auth::password.token
39
                    'uses' => 'ResetPasswordController@showResetForm'
40
                ]);
41
42
                $this->post('reset', [
43
                    'as'   => 'post',  // auth::password.post
44
                    'uses' => 'ResetPasswordController@reset'
45
                ]);
46
            });
47
        }
48
    }
49
50
    /* ------------------------------------------------------------------------------------------------
51
     |  Other Functions
52
     | ------------------------------------------------------------------------------------------------
53
     */
54
    /**
55
     * Check if enabled.
56
     *
57
     * @return bool
58
     */
59
    protected function isEnabled()
60
    {
61
        return config('arcanesoft.auth.authentication.enabled.password', false);
62
    }
63
64
    /**
65
     * Get the route attributes.
66
     *
67
     * @return array
68
     */
69
    protected function getRouteAttributes()
70
    {
71
        return array_merge([
72
            'prefix' => 'password',
73
            'as'     => 'password.',
74
        ], config('arcanesoft.auth.authentication.routes.password', []));
75
    }
76
}
77