-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUserAdapter.class.php
More file actions
75 lines (66 loc) · 1.21 KB
/
UserAdapter.class.php
File metadata and controls
75 lines (66 loc) · 1.21 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* UserAdapter Class
* @author Michael Peacock <mkpeacock@gmail.com>
*/
class UserAdapter{
/**
* User object as it relates to your framework/CMS/use case
* @var Object
*/
private $user;
/**
* Constructor
* @param Object $user
* @return void
*/
public function __construct( $user=null )
{
$this->user = $user;
}
/**
* Get the user ID from the user object
* @return int
*/
public function getUserID()
{
return $this->user->getUserID();
}
/**
* Get a users verification code
* @return String
*/
public function getVerificationCode()
{
return $this->user->getVerificationCode();
}
/**
* Set a users verification code
* @param String $code
* @return void
*/
public function setVerificationCode( $code )
{
$this->user->setVerificationCode( $code );
$this->user->save();
}
/**
* Verify the user based on the code entered
* @param String $code
* @return bool
*/
public function verify( $code )
{
if( $this->getVerificationCode() == $code )
{
$this->user->setVerified( true );
$this->user->save();
return true;
}
else
{
return false;
}
}
}
?>