2 /* This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3 and is published under the AGPL license. */
5 class Syj_Model_Pending_ResetPassword extends Syj_Model_Pending
7 protected $_action = 'reset_password';
9 protected function _run() {
10 $this->_newpwd = pwdgen\PwdGenerator::generate();
11 $this->_user->password = sha1($this->_newpwd);
12 $userMapper = new Syj_Model_UserMapper();
13 $userMapper->save($this->_user);
16 public function _notify() {
17 switch ($this->_notifications_number) {
19 $subject = $this->translate("[SYJ] Reset your password", $this->_user->lang);
20 $text = $this->translate("Hi %user%,
22 Someone, probably you, has asked to reset your password. If you want to reset
23 your password, please follow this link:
26 If you do not not confirm within 2 days, your password will not be reset.
28 Please do not reply this email. If you need to contact us, please use the form
29 contact at %contacturl%
33 Syj team", $this->_user->lang);
37 $text = str_replace('%user%', $this->_user->pseudo, $text);
38 $text = str_replace('%hashurl%', $this->getHashUrl(), $text);
39 $text = str_replace('%contacturl%', $this->getContactUrl(), $text);
41 return $this->_sendMail($subject, $text);
43 protected function _cancel() {
47 public function getNewpwd() {
48 return $this->_newpwd;