password
This commit is contained in:
parent
315fe1ab67
commit
3a4d58f6b9
|
@ -36,6 +36,8 @@
|
||||||
Router::connect('/company/registration', array('controller' => 'registration', 'action' => 'company'));
|
Router::connect('/company/registration', array('controller' => 'registration', 'action' => 'company'));
|
||||||
//Router::connect('/registration', array('controller' => 'registration', 'action' => 'main'));
|
//Router::connect('/registration', array('controller' => 'registration', 'action' => 'main'));
|
||||||
Router::connect('/registration', array('controller' => 'registration', 'action' => 'worker'));
|
Router::connect('/registration', array('controller' => 'registration', 'action' => 'worker'));
|
||||||
|
Router::connect('/password/reset', array('controller' => 'registration', 'action' => 'password_reset'));
|
||||||
|
Router::connect('/password/replace/:code', array('controller' => 'registration', 'action' => 'password_replace'),array("code" => ".+"));
|
||||||
Router::connect('/registration/active/:code', array('controller' => 'registration', 'action' => 'active'),array("code" => ".+"));
|
Router::connect('/registration/active/:code', array('controller' => 'registration', 'action' => 'active'),array("code" => ".+"));
|
||||||
|
|
||||||
Router::connect('/profil', array('controller' => 'user', 'action' => 'profil'));
|
Router::connect('/profil', array('controller' => 'user', 'action' => 'profil'));
|
||||||
|
|
|
@ -4,150 +4,204 @@ App::uses('AppController', 'Controller');
|
||||||
|
|
||||||
class RegistrationController extends AppController {
|
class RegistrationController extends AppController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller use User Model
|
* This controller use User Model
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
public $componens = array('MiconwareSession');
|
public $componens = array('MiconwareSession');
|
||||||
public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany','User','DreamjobListCity');
|
public $uses = array('Mannerofaddress', 'DreamjobListGraducation', 'DreamjobListBranch', 'DreamjobWorker', 'DreamjobCompany', 'User', 'DreamjobListCity');
|
||||||
|
|
||||||
|
public function main() {
|
||||||
|
$this->MiconwareSession->init($this);
|
||||||
|
$this->MiconwareSession->initWeb($this);
|
||||||
|
if (!$this->MiconwareSession->isLoggedin()) {
|
||||||
|
$this->render('/Registration/main');
|
||||||
|
} else {
|
||||||
|
$this->set('error', 'dreamjob.error.loggedin');
|
||||||
|
$this->render('/Home/error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function main() {
|
public function company() {
|
||||||
$this->MiconwareSession->init($this);
|
$this->MiconwareSession->init($this);
|
||||||
$this->MiconwareSession->initWeb($this);
|
$this->MiconwareSession->initWeb($this);
|
||||||
if(!$this->MiconwareSession->isLoggedin()){
|
if (!$this->MiconwareSession->isLoggedin()) {
|
||||||
$this->render('/Registration/main');
|
$regResult = false;
|
||||||
}else{
|
if ($this->request->is('post')) {
|
||||||
$this->set('error', 'dreamjob.error.loggedin');
|
if ($this->request->data['DreamjobCompany']['agb']) {
|
||||||
$this->render('/Home/error');
|
unset($this->request->data['DreamjobCompany']['agb']);
|
||||||
}
|
if ($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
|
||||||
}
|
$data = array();
|
||||||
|
$data['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']);
|
||||||
|
$data['User']['mail'] = $this->request->data['User']['mail'];
|
||||||
|
$data['DreamjobUser']['city_id'] = $this->request->data['DreamjobUser']['city_id'];
|
||||||
|
$data['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street'];
|
||||||
|
$data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
|
||||||
|
$data['AppUser']['nickname'] = $this->request->data['AppUser']['nickname'];
|
||||||
|
$data['AppUser']['take_systemwide'] = true;
|
||||||
|
|
||||||
public function company() {
|
$data['DreamjobCompany']['corporateform'] = $this->request->data['DreamjobCompany']['corporateform'];
|
||||||
$this->MiconwareSession->init($this);
|
$data['DreamjobCompany']['owner'] = $this->request->data['DreamjobCompany']['owner'];
|
||||||
$this->MiconwareSession->initWeb($this);
|
$data['DreamjobCompany']['branch_id'] = $this->request->data['DreamjobCompany']['branch_id'];
|
||||||
if(!$this->MiconwareSession->isLoggedin()){
|
$data['DreamjobCompany']['headcount'] = $this->request->data['DreamjobCompany']['headcount'];
|
||||||
$regResult = false;
|
$data['DreamjobCompany']['bank_details'] = '';
|
||||||
if ($this->request->is('post')){
|
//$data['DreamjobCompany']['bank_details'] = $this->request->data['DreamjobCompany']['bank_details'];
|
||||||
if($this->request->data['DreamjobCompany']['agb']) {
|
$data['DreamjobCompany']['website'] = $this->request->data['DreamjobCompany']['website'];
|
||||||
unset($this->request->data['DreamjobCompany']['agb']);
|
$key = $this->MiconwareSession->generateKey();
|
||||||
if($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
|
$data['User']['code'] = "a:" . $key;
|
||||||
$data = array();
|
$data['User']['is_active'] = false;
|
||||||
$data['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']);
|
|
||||||
$data['User']['mail'] = $this->request->data['User']['mail'];
|
|
||||||
$data['DreamjobUser']['city_id'] = $this->request->data['DreamjobUser']['city_id'];
|
|
||||||
$data['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street'];
|
|
||||||
$data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
|
|
||||||
$data['AppUser']['nickname'] = $this->request->data['AppUser']['nickname'];
|
|
||||||
$data['AppUser']['take_systemwide'] = true;
|
|
||||||
|
|
||||||
$data['DreamjobCompany']['corporateform'] = $this->request->data['DreamjobCompany']['corporateform'];
|
$result = $this->DreamjobCompany->registration($data);
|
||||||
$data['DreamjobCompany']['owner'] = $this->request->data['DreamjobCompany']['owner'];
|
if ($result) {
|
||||||
$data['DreamjobCompany']['branch_id'] = $this->request->data['DreamjobCompany']['branch_id'];
|
$regResult = true;
|
||||||
$data['DreamjobCompany']['headcount'] = $this->request->data['DreamjobCompany']['headcount'];
|
$this->MiconwareSession->setFlash(__('dreamjob.registration.done'), 'flash', array('alert' => 'success'));
|
||||||
$data['DreamjobCompany']['bank_details'] = '';
|
} else {
|
||||||
//$data['DreamjobCompany']['bank_details'] = $this->request->data['DreamjobCompany']['bank_details'];
|
$this->MiconwareSession->setFlash(__('dreamjob.registration.error'), 'flash', array('alert' => 'danger'));
|
||||||
$data['DreamjobCompany']['website'] = $this->request->data['DreamjobCompany']['website'];
|
}
|
||||||
$key = $this->MiconwareSession->generateKey();
|
} else if ($this->request->data['User']['password1'] != '' or $this->request->data['User']['password2'] != '') {
|
||||||
$data['User']['code'] = "a:".$key;
|
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'), 'flash', array('alert' => 'danger'));
|
||||||
$data['User']['is_active'] = false;
|
}
|
||||||
|
} else {
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.agb.error.notAccept'), 'flash', array('alert' => 'danger'));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (empty($this->request->data['DreamjobCompany']['website']))
|
||||||
|
$this->request->data['DreamjobCompany']['website'] = 'http://';
|
||||||
|
$this->set('result', $regResult);
|
||||||
|
$this->set('cities', $this->DreamjobListCity->find('list'));
|
||||||
|
$this->set('branches', $this->DreamjobListBranch->find('list'));
|
||||||
|
$this->render('/Registration/company');
|
||||||
|
}else {
|
||||||
|
$this->set('error', 'dreamjob.error.loggedin');
|
||||||
|
$this->render('/Home/error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->DreamjobCompany->registration($data);
|
public function worker() {
|
||||||
if ($result) {
|
$this->MiconwareSession->init($this);
|
||||||
$regResult = true;
|
$this->MiconwareSession->initWeb($this);
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.registration.done'),'flash',array('alert'=>'success'));
|
if (!$this->MiconwareSession->isLoggedin()) {
|
||||||
}else{
|
$regResult = false;
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.registration.error'),'flash',array('alert'=>'danger'));
|
if ($this->request->is('post')) {
|
||||||
}
|
if ($this->request->data['DreamjobWorker']['agb']) {
|
||||||
}else if($this->request->data['User']['password1']!='' or $this->request->data['User']['password2']!=''){
|
unset($this->request->data['DreamjobWorker']['agb']);
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'),'flash',array('alert'=>'danger'));
|
if ($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
|
||||||
}
|
$data = array();
|
||||||
}else{
|
$data['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']);
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.agb.error.notAccept'),'flash',array('alert'=>'danger'));
|
$data['User']['mail'] = $this->request->data['User']['mail'];
|
||||||
}
|
$data['DreamjobUser']['city_id'] = $this->request->data['DreamjobUser']['city_id'];
|
||||||
}else
|
$data['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street'];
|
||||||
if(empty($this->request->data['DreamjobCompany']['website']))
|
$data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
|
||||||
$this->request->data['DreamjobCompany']['website'] ='http://';
|
$data['AppUser']['bday'] = $this->request->data['AppUser']['bday'];
|
||||||
$this->set('result',$regResult);
|
$data['AppUser']['first_name'] = $this->request->data['AppUser']['first_name'];
|
||||||
$this->set('cities',$this->DreamjobListCity->find('list'));
|
$data['AppUser']['last_name'] = $this->request->data['AppUser']['last_name'];
|
||||||
$this->set('branches',$this->DreamjobListBranch->find('list'));
|
$data['AppUser']['take_systemwide'] = true;
|
||||||
$this->render('/Registration/company');
|
|
||||||
}else{
|
|
||||||
$this->set('error', 'dreamjob.error.loggedin');
|
|
||||||
$this->render('/Home/error');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function worker() {
|
//WORKER
|
||||||
$this->MiconwareSession->init($this);
|
$data['AppUser']['mannerofaddress_id'] = $this->request->data['AppUser']['mannerofaddress_id'];
|
||||||
$this->MiconwareSession->initWeb($this);
|
$data['DreamjobWorker']['country'] = $this->request->data['DreamjobWorker']['country'];
|
||||||
if(!$this->MiconwareSession->isLoggedin()){
|
$data['DreamjobWorker']['iam'] = $this->request->data['DreamjobWorker']['iam'];
|
||||||
$regResult = false;
|
$data['DreamjobWorker']['graducation_id'] = $this->request->data['DreamjobWorker']['graducation_id'];
|
||||||
if ($this->request->is('post')){
|
$data['DreamjobWorker']['searchhidden'] = true;
|
||||||
if($this->request->data['DreamjobWorker']['agb']) {
|
$data['DreamjobWorker']['workexperience'] = $this->request->data['DreamjobWorker']['workexperience'];
|
||||||
unset($this->request->data['DreamjobWorker']['agb']);
|
|
||||||
if($this->request->data['User']['password1'] == $this->request->data['User']['password2']) {
|
|
||||||
$data = array();
|
|
||||||
$data['User']['password'] = $this->MiconwareSession->create_hash($this->request->data['User']['password1']);
|
|
||||||
$data['User']['mail'] = $this->request->data['User']['mail'];
|
|
||||||
$data['DreamjobUser']['city_id'] = $this->request->data['DreamjobUser']['city_id'];
|
|
||||||
$data['DreamjobUser']['street'] = $this->request->data['DreamjobUser']['street'];
|
|
||||||
$data['DreamjobUser']['postcode'] = $this->request->data['DreamjobUser']['postcode'];
|
|
||||||
$data['AppUser']['bday'] = $this->request->data['AppUser']['bday'];
|
|
||||||
$data['AppUser']['first_name'] = $this->request->data['AppUser']['first_name'];
|
|
||||||
$data['AppUser']['last_name'] = $this->request->data['AppUser']['last_name'];
|
|
||||||
$data['AppUser']['take_systemwide'] = true;
|
|
||||||
|
|
||||||
//WORKER
|
$key = $this->MiconwareSession->generateKey();
|
||||||
$data['AppUser']['mannerofaddress_id'] = $this->request->data['AppUser']['mannerofaddress_id'];
|
$data['User']['code'] = "a:" . $key;
|
||||||
$data['DreamjobWorker']['country'] = $this->request->data['DreamjobWorker']['country'];
|
$data['User']['is_active'] = false;
|
||||||
$data['DreamjobWorker']['iam'] = $this->request->data['DreamjobWorker']['iam'];
|
|
||||||
$data['DreamjobWorker']['graducation_id'] = $this->request->data['DreamjobWorker']['graducation_id'];
|
|
||||||
$data['DreamjobWorker']['searchhidden'] = true;
|
|
||||||
$data['DreamjobWorker']['workexperience'] = $this->request->data['DreamjobWorker']['workexperience'];
|
|
||||||
|
|
||||||
$key = $this->MiconwareSession->generateKey();
|
$result = $this->DreamjobWorker->registration($data);
|
||||||
$data['User']['code'] = "a:".$key;
|
|
||||||
$data['User']['is_active'] = false;
|
|
||||||
|
|
||||||
$result = $this->DreamjobWorker->registration($data);
|
if ($result) {
|
||||||
|
$regResult = true;
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.registration.done'), 'flash', array('alert' => 'success'));
|
||||||
|
} else {
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.registration.error'), 'flash', array('alert' => 'danger'));
|
||||||
|
}
|
||||||
|
} else if ($this->request->data['User']['password1'] != '' or $this->request->data['User']['password2'] != '') {
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'), 'flash', array('alert' => 'danger'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.agb.error.notAccept'), 'flash', array('alert' => 'danger'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->set('result', $regResult);
|
||||||
|
$this->set('cities', $this->DreamjobListCity->find('list'));
|
||||||
|
$this->set('mannerofaddresses', $this->Mannerofaddress->find('list'));
|
||||||
|
$this->set('graducations', $this->DreamjobListGraducation->find('list'));
|
||||||
|
$this->render('/Registration/worker');
|
||||||
|
} else {
|
||||||
|
$this->set('error', 'dreamjob.error.loggedin');
|
||||||
|
$this->render('/Home/error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($result) {
|
public function active() {
|
||||||
$regResult = true;
|
$this->MiconwareSession->init($this);
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.registration.done'),'flash',array('alert'=>'success'));
|
$this->MiconwareSession->initWeb($this);
|
||||||
}else{
|
if (!$this->MiconwareSession->isLoggedin() and ! empty($this->request->params['code']) and ! empty($this->request->query['mail'])) {
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.registration.error'),'flash',array('alert'=>'danger'));
|
$result = $this->User->activeLinkUser($this->request->query['mail'], $this->request->params['code']);
|
||||||
}
|
$this->set("result", $result);
|
||||||
}else if($this->request->data['User']['password1']!='' or $this->request->data['User']['password2']!=''){
|
$this->render('/Registration/active');
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'),'flash',array('alert'=>'danger'));
|
} else {
|
||||||
}
|
$this->set('error', 'dreamjob.error.loggedin');
|
||||||
}else{
|
$this->render('/Home/error');
|
||||||
$this->MiconwareSession->setFlash(__('dreamjob.agb.error.notAccept'),'flash',array('alert'=>'danger'));
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$this->set('result',$regResult);
|
public function password_reset() {
|
||||||
$this->set('cities',$this->DreamjobListCity->find('list'));
|
$this->MiconwareSession->init($this);
|
||||||
$this->set('mannerofaddresses',$this->Mannerofaddress->find('list'));
|
$this->MiconwareSession->initWeb($this);
|
||||||
$this->set('graducations',$this->DreamjobListGraducation->find('list'));
|
if (!$this->MiconwareSession->isLoggedin()) {
|
||||||
$this->render('/Registration/worker');
|
if ($this->request->is('post')) {
|
||||||
}else{
|
$key = $this->MiconwareSession->generateKey();
|
||||||
$this->set('error', 'dreamjob.error.loggedin');
|
$profil['User']['mail'] = $this->request->data['User']['mail'];
|
||||||
$this->render('/Home/error');
|
$profil['User']['code'] = "f:" . $key;
|
||||||
}
|
$result = $this->User->sendPasswortReset($profil);
|
||||||
}
|
|
||||||
public function active(){
|
if ($result) {
|
||||||
$this->MiconwareSession->init($this);
|
$this->MiconwareSession->setFlash(__('dreamjob.password_reset.send'), 'flash', array('alert' => 'success'));
|
||||||
$this->MiconwareSession->initWeb($this);
|
} else {
|
||||||
if(!$this->MiconwareSession->isLoggedin() and !empty($this->request->params['code']) and !empty($this->request->query['mail']) ){
|
$this->MiconwareSession->setFlash(__('dreamjob.password_reset.send.error'), 'flash', array('alert' => 'danger'));
|
||||||
$result = $this->User->activeLinkUser($this->request->query['mail'],$this->request->params['code']);
|
}
|
||||||
$this->set("result",$result);
|
}
|
||||||
$this->render('/Registration/active');
|
$this->render('/Registration/password_reset');
|
||||||
}else{
|
} else {
|
||||||
$this->set('error', 'dreamjob.error.loggedin');
|
$this->set('error', 'dreamjob.error.loggedin');
|
||||||
$this->render('/Home/error');
|
$this->render('/Home/error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function password_replace() {
|
||||||
|
$this->MiconwareSession->init($this);
|
||||||
|
$this->MiconwareSession->initWeb($this);
|
||||||
|
if (!$this->MiconwareSession->isLoggedin() and ! empty($this->request->params['code']) and ! empty($this->request->query['mail'])) {
|
||||||
|
$send = false;
|
||||||
|
$try = $this->User->find('first',array('conditions'=>array('User.code LIKE'=>'_:'.$this->request->params['code'],'User.mail'=>$this->request->query['mail'])));
|
||||||
|
if (count($try)<2) {
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.password_replace.notFound'), 'flash', array('alert' => 'danger'));
|
||||||
|
$send = true;
|
||||||
|
}
|
||||||
|
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']);
|
||||||
|
if ($result) {
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.password_replace.done'), 'flash', array('alert' => 'success'));
|
||||||
|
} else {
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.password_replace.error'), 'flash', array('alert' => 'danger'));
|
||||||
|
}
|
||||||
|
}else
|
||||||
|
$this->MiconwareSession->setFlash(__('dreamjob.error.password.notEqual'), 'flash', array('alert' => 'danger'));
|
||||||
|
}
|
||||||
|
$this->render('/Registration/password_replace');
|
||||||
|
} else {
|
||||||
|
$this->set('error', 'dreamjob.error.link');
|
||||||
|
$this->render('/Home/error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1142,6 +1142,32 @@ msgstr ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
msgid "dreamjob.password.reset"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.password.replace"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.password.send"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.password_reset.send"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.password_reset.send.error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.password_replace.error"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.password_replace.done"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.password_replace.notFound"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Generierte Fehlermeldungen eigenarbeit!
|
# Generierte Fehlermeldungen eigenarbeit!
|
||||||
|
@ -1182,3 +1208,10 @@ msgstr ""
|
||||||
msgid "dreamjob.error.opening.notFound.text"
|
msgid "dreamjob.error.opening.notFound.text"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
# -
|
||||||
|
msgid "dreamjob.error.link.title"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "dreamjob.error.link.text"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
|
App::uses('CakeEmail', 'Network/Email');
|
||||||
/**
|
/**
|
||||||
* MicSysMicacc Model
|
* MicSysMicacc Model
|
||||||
*
|
*
|
||||||
|
@ -41,6 +42,15 @@ class User extends AppModel {
|
||||||
$key = substr($data['User']['code'],2);
|
$key = substr($data['User']['code'],2);
|
||||||
$Email->viewVars(array('data'=>$data,'key'=>$key));
|
$Email->viewVars(array('data'=>$data,'key'=>$key));
|
||||||
return $Email->send();
|
return $Email->send();
|
||||||
|
}
|
||||||
|
public static function sendPasswortResetMail($data){
|
||||||
|
$Email = new CakeEmail('dreamjobMain');
|
||||||
|
$Email->to($data['User']['mail']);
|
||||||
|
$Email->subject('Welcome to our really cool thing');
|
||||||
|
$Email->template('password_reset');
|
||||||
|
$key = substr($data['User']['code'],2);
|
||||||
|
$Email->viewVars(array('data'=>$data,'key'=>$key));
|
||||||
|
return $Email->send();
|
||||||
}
|
}
|
||||||
public function sendDelete($data){
|
public function sendDelete($data){
|
||||||
$dataSource = $this->getDataSource();
|
$dataSource = $this->getDataSource();
|
||||||
|
@ -60,6 +70,27 @@ class User extends AppModel {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public function sendPasswortReset($data){
|
||||||
|
$dataSource = $this->getDataSource();
|
||||||
|
$dataSource->begin();
|
||||||
|
$result = $this->findByMail($data['User']['mail']);
|
||||||
|
if($result)
|
||||||
|
$this->id = $result['User']['id'];
|
||||||
|
if($result)
|
||||||
|
$result = $this->saveField('code',$data['User']['code']);
|
||||||
|
if($result)
|
||||||
|
$result = $this->saveField('is_active',false);
|
||||||
|
if($result)
|
||||||
|
$result=self::sendPasswortResetMail($data);
|
||||||
|
|
||||||
|
if($result) {
|
||||||
|
$dataSource->commit();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
$dataSource->rollback();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public function activeLinkUser($mail,$key){
|
public function activeLinkUser($mail,$key){
|
||||||
$dataSource = $this->getDataSource();
|
$dataSource = $this->getDataSource();
|
||||||
|
|
||||||
|
@ -192,6 +223,9 @@ class User extends AppModel {
|
||||||
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
//'on' => 'create', // Limit validation to 'create' or 'update' operations
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
/*
|
||||||
|
* Legend: a=aktivierungscode, d=deaktivier zur Löschund, f=password vergessen
|
||||||
|
*/
|
||||||
'code' => array(
|
'code' => array(
|
||||||
'notEmpty' => array(
|
'notEmpty' => array(
|
||||||
'rule' => array('notEmpty'),
|
'rule' => array('notEmpty'),
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
echo $this->Html->link(__('dreamjob.password.reset.link'),array('controller' => 'registration', 'action' => 'password_replace','code'=>$key,
|
||||||
|
'?'=>array('mail'=>$data['User']['mail']),'full_base' => true) );
|
||||||
|
?>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?php
|
||||||
|
echo $this->Html->url(array('controller'=>'registration','action'=>'password_replace','code'=>$key,
|
||||||
|
'?'=>array('mail'=>$data['User']['mail'])),true);
|
||||||
|
?>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="box">
|
||||||
|
<h1><?=__('dreamjob.password.replace');?></h1>
|
||||||
|
<?php
|
||||||
|
echo $this->Form->create(false,$default_Form);
|
||||||
|
echo $this->Form->input('User.password1',array('label'=>array('text'=>__("dreamjob.password"),"class"=>$default_Form['inputDefaults']['label']['class']),'type'=>'password'));
|
||||||
|
echo $this->Form->input('User.password2',array('label'=>array('text'=>__("dreamjob.password2"),"class"=>$default_Form['inputDefaults']['label']['class']),'type'=>'password'));
|
||||||
|
?>
|
||||||
|
<div class="buttonrow">
|
||||||
|
<?=$this->Form->button(__('dreamjob.save'),array('div' => false,'class'=>"btn btn-primary ",'type' => 'submit'));?>
|
||||||
|
</div>
|
||||||
|
<?php echo $this->Form->end(); ?>
|
||||||
|
</div>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="box">
|
||||||
|
<h1><?=__('dreamjob.password.reset');?></h1>
|
||||||
|
<?php
|
||||||
|
echo $this->Form->create(false,$default_Form);
|
||||||
|
echo $this->Form->input('User.mail',array('label'=>array('text'=>__("dreamjob.mail"),"class"=>$default_Form['inputDefaults']['label']['class'])));
|
||||||
|
?>
|
||||||
|
<div class="buttonrow">
|
||||||
|
<?=$this->Form->button(__('dreamjob.password.send'),array('div' => false,'class'=>"btn btn-primary ",'type' => 'submit'));?>
|
||||||
|
</div>
|
||||||
|
<?php echo $this->Form->end(); ?>
|
||||||
|
</div>
|
Loading…
Reference in New Issue