This commit is contained in:
Martin Müller 2014-05-11 15:22:27 +02:00
parent 3a4d58f6b9
commit d21c9d78c2
2 changed files with 18 additions and 2 deletions

View File

@ -185,8 +185,7 @@ class RegistrationController extends AppController {
if (!$send and $this->request->is('post')) {
if ($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
$profil['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']);
$this->User->id=$try['User']['id'];
$result = $this->User->saveField('password',$profil['User']['password']);
$result = $this->User->replace_password($try,$profil['User']['password']);
if ($result) {
$this->MiconwareSession->setFlash(__('dreamjob.password_replace.done'), 'flash', array('alert' => 'success'));
} else {

View File

@ -91,6 +91,23 @@ class User extends AppModel {
}
return false;
}
public function replace_password($data,$password){
$dataSource = $this->getDataSource();
$dataSource->begin();
$this->id = $data['User']['id'];
if($result)
$result = $this->saveField('code','');
if($result)
$result = $this->saveField('password',$password);
if($result) {
$dataSource->commit();
return true;
} else {
$dataSource->rollback();
}
return false;
}
public function activeLinkUser($mail,$key){
$dataSource = $this->getDataSource();