1 | <?php |
||
10 | class User extends ActiveRecordModel |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var string $tableName name of the database table. |
||
15 | */ |
||
16 | protected $tableName = "User"; |
||
17 | |||
18 | /** |
||
19 | * Columns in the table. |
||
20 | * |
||
21 | * @var integer $id primary key auto incremented. |
||
22 | */ |
||
23 | public $id; |
||
24 | public $acronym; |
||
25 | public $password; |
||
26 | public $email; |
||
27 | public $gravatar; |
||
28 | public $created; |
||
29 | public $updated; |
||
30 | public $deleted; |
||
31 | public $active; |
||
32 | |||
33 | /** |
||
34 | * Set the password. |
||
35 | * |
||
36 | * @param string $password the password to use. |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | 1 | public function setPassword($password) |
|
41 | { |
||
42 | 1 | $this->password = password_hash($password, PASSWORD_DEFAULT); |
|
43 | 1 | } |
|
44 | |||
45 | /** |
||
46 | * Verify the acronym and the password, if successful the object contains |
||
47 | * all details from the database row. |
||
48 | * |
||
49 | * @param string $acronym acronym to check. |
||
50 | * @param string $password the password to use. |
||
51 | * |
||
52 | * @return boolean true if acronym and password matches, else false. |
||
53 | */ |
||
54 | public function verifyPassword($acronym, $password) |
||
59 | |||
60 | /** |
||
61 | * @param string email |
||
62 | * |
||
63 | * @return string gravatar |
||
64 | **/ |
||
65 | 2 | public function gravatar($email) |
|
69 | } |
||
70 |