From 8a4afbcfefb283d8217ae6be0f96d7e01bbbd21d Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 10 Mar 2016 16:36:52 +0100 Subject: * password change form in profile page --- app/php/components/HeaderMenu.tpl | 4 +++ app/php/pages/Profile.page | 53 ++++++++++++++++++++++++++++++++++++++- app/php/pages/Profile.php | 17 +++++++++++++ 3 files changed, 73 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/php/components/HeaderMenu.tpl b/app/php/components/HeaderMenu.tpl index eceea1b..ff1d417 100644 --- a/app/php/components/HeaderMenu.tpl +++ b/app/php/components/HeaderMenu.tpl @@ -3,6 +3,10 @@ <%= $this->Service->constructUrl('Login') %> <%= $this->User->IsGuest %> + + <%= $this->Service->constructUrl('Profile') %> + <%= !$this->User->IsGuest %> + Logout (<%= $this->User->Name %>) <%= !$this->User->IsGuest %> diff --git a/app/php/pages/Profile.page b/app/php/pages/Profile.page index b5dcf37..71ed112 100644 --- a/app/php/pages/Profile.page +++ b/app/php/pages/Profile.page @@ -1,3 +1,54 @@ - Profile + Change password
+ Current password: + + + +
+ New password: + + +
+ Repeat password: + + + +
+ +
diff --git a/app/php/pages/Profile.php b/app/php/pages/Profile.php index fb2c89f..6df87bc 100644 --- a/app/php/pages/Profile.php +++ b/app/php/pages/Profile.php @@ -2,6 +2,23 @@ class Profile extends TPage { + public function checkPassword($sender, $param) { + $param->IsValid = DbUser::verifyPassword( + $this->Password->Text, $this->User->DbRecord->Password + ); + } + + public function changePassword($sender, $param) { + $this->SuccessMessage->Visible = FALSE; + if ($this->Page->IsValid) { + $this->User->DbRecord->Password = DbUser::generatePassword( + $this->NewPassword->Text + ); + $this->User->DbRecord->save(); + $this->SuccessMessage->Visible = TRUE; + } + } + } ?> -- cgit v1.2.3