-
-
Notifications
You must be signed in to change notification settings - Fork 363
Expand file tree
/
Copy pathVerificationRepository.php
More file actions
46 lines (41 loc) · 1.27 KB
/
VerificationRepository.php
File metadata and controls
46 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* UserFrosting (http://www.userfrosting.com)
*
* @link https://github.com/userfrosting/UserFrosting
* @copyright Copyright (c) 2019 Alexander Weissman
* @license https://github.com/userfrosting/UserFrosting/blob/master/LICENSE.md (MIT License)
*/
namespace UserFrosting\Sprinkle\Account\Repository;
use UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface;
/**
* Token repository class for new account verifications and email change verifications.
*
* @author Alex Weissman (https://alexanderweissman.com)
*
* @see https://learn.userfrosting.com/users/user-accounts
*/
class VerificationRepository extends TokenRepository
{
/**
* {@inheritdoc}
*/
protected $modelIdentifier = 'verification';
/**
* {@inheritdoc}
*/
protected function updateUser(UserInterface $user, $args)
{
// If this is email update verification
if ( $user->flag_verified && $user->newEmail !== "" ) {
// Update email and remove requested
$user->email = $user->newEmail;
$user->newEmail = "";
} else {
// New user verification
$user->flag_verified = 1;
}
// TODO: generate user activity? or do this in controller?
$user->save();
}
}