Passed
Push — develop ( 4cbaa0...09ba9e )
by Ngoding
05:32
created

EmailVerificationRequest::authorize()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3.009

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 9
c 1
b 0
f 0
nc 3
nop 0
dl 0
loc 17
ccs 9
cts 10
cp 0.9
crap 3.009
rs 9.9666
1
<?php
2
3
namespace App\Http\Requests\Auth;
4
5
use Illuminate\Foundation\Auth\EmailVerificationRequest as BaseEmailVerificationRequest;
6
7
/**
8
 * @method \App\Models\User|null user() Get the user making the request.
9
 */
10
class EmailVerificationRequest extends BaseEmailVerificationRequest
11
{
12
    /**
13
     * {@inheritDoc}
14
     */
15 2
    public function authorize()
16
    {
17 2
        if (! hash_equals(
18 2
            (string) $this->route('id'),
19 2
            sha1($this->user()->getKeyForVerification()
20
        ))) {
21
            return false;
22
        }
23
24 2
        if (! hash_equals(
25 2
            (string) $this->route('hash'),
26 2
            sha1($this->user()->getEmailForVerification()
27
        ))) {
28 1
            return false;
29
        }
30
31 1
        return true;
32
    }
33
}
34