blob: 45ce65608cf791e1e908c1cd8917ef8352bcfa08 (
plain)
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
|
<?php
Prado::using('Application.web.FacadeTemplateControl');
Prado::using('Application.user.DbUser');
Prado::using('Application.facades.UserFacade');
class PasswordChange extends FacadeTemplateControl {
public function getUserToChange() {
return $this->getControlState('user');
}
public function setUserToChange(DbUser $user) {
if ($user->IsGuest && !$this->Page->IsCallBack) {
throw new TInvalidDataValueException(
Prado::localize(
'Password change impossible for guest user'
)
);
}
$this->setControlState('user', $user);
}
public function checkPassword($sender, $param) {
$param->IsValid = $this->getFacade()->verifyUserPassword(
$this->Password->Text, $this->UserToChange
);
}
public function changePassword($sender, $param) {
$this->SuccessMessage->Visible = FALSE;
if ($this->Page->IsValid) {
$this->getFacade()->changePassword(
$this->UserToChange,
$this->NewPassword->Text
);
$this->SuccessMessage->Visible = TRUE;
}
}
}
?>
|