Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Foundation\Auth;
4
 
5
use Illuminate\Auth\Events\Verified;
6
use Illuminate\Foundation\Http\FormRequest;
7
 
8
class EmailVerificationRequest extends FormRequest
9
{
10
    /**
11
     * Determine if the user is authorized to make this request.
12
     *
13
     * @return bool
14
     */
15
    public function authorize()
16
    {
17
        if (! hash_equals((string) $this->user()->getKey(), (string) $this->route('id'))) {
18
            return false;
19
        }
20
 
21
        if (! hash_equals(sha1($this->user()->getEmailForVerification()), (string) $this->route('hash'))) {
22
            return false;
23
        }
24
 
25
        return true;
26
    }
27
 
28
    /**
29
     * Get the validation rules that apply to the request.
30
     *
31
     * @return array
32
     */
33
    public function rules()
34
    {
35
        return [
36
            //
37
        ];
38
    }
39
 
40
    /**
41
     * Fulfill the email verification request.
42
     *
43
     * @return void
44
     */
45
    public function fulfill()
46
    {
47
        if (! $this->user()->hasVerifiedEmail()) {
48
            $this->user()->markEmailAsVerified();
49
 
50
            event(new Verified($this->user()));
51
        }
52
    }
53
 
54
    /**
55
     * Configure the validator instance.
56
     *
57
     * @param  \Illuminate\Validation\Validator  $validator
58
     * @return void
59
     */
60
    public function withValidator($validator)
61
    {
62
        return $validator;
63
    }
64
}