diff --git a/app/Config/email.php b/app/Config/email.php index d158f0c..281b9a0 100755 --- a/app/Config/email.php +++ b/app/Config/email.php @@ -51,8 +51,8 @@ class EmailConfig { 'from' => array('noreply@dreamjob.cc'=>'Dreamjob-Site'), 'replyTo' => array('service@dreamjob.cc'=>'[Dreamjob] Service'), 'emailFormat'=>'both', - 'charset' => 'utf-8', - 'headerCharset' => 'utf-8', + //'charset' => 'utf-8', + //'headerCharset' => 'utf-8', ); public $smtp = array( diff --git a/app/Config/routes.php b/app/Config/routes.php index 03eda0f..00067ad 100755 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -34,6 +34,7 @@ Router::connect('/registration', array('controller' => 'registration', 'action' => 'main')); Router::connect('/registration/user', array('controller' => 'registration', 'action' => 'worker')); Router::connect('/registration/company', array('controller' => 'registration', 'action' => 'company')); + Router::connect('/registration/active/:code', array('controller' => 'registration', 'action' => 'active'),array("code" => "(?i:code)")); Router::connect('/profil', array('controller' => 'user', 'action' => 'profil')); Router::connect('/profil/page/:page', array('controller' => 'user', 'action' => 'profil'),array("page" => "[0-9]+")); diff --git a/app/Controller/RegistrationController.php b/app/Controller/RegistrationController.php index ed57dcf..da057c9 100644 --- a/app/Controller/RegistrationController.php +++ b/app/Controller/RegistrationController.php @@ -13,12 +13,12 @@ class RegistrationController extends AppController { public $componens = array('Email','MiconwareSession'); public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany'); - private function registrationMail($data){ + private function registrationMail($data,$key){ $Email = new CakeEmail('dreamjobMain'); $Email->to($data['User']['mail']); $Email->subject('Welcome to our really cool thing'); - $Email->template('simple_message'); - $Email->viewVars(array('data'=>$data)); + $Email->template('registration'); + $Email->viewVars(array('data'=>$data,'key'=>$key)); return $Email->send(); } @@ -56,11 +56,13 @@ class RegistrationController extends AppController { $data['DreamjobCompany']['bank_details'] = ''; //$data['DreamjobCompany']['bank_details'] = $this->request->data['DreamjobCompany']['bank_details']; $data['DreamjobCompany']['website'] = $this->request->data['DreamjobCompany']['website']; - $data['User']['code'] = "a:".$this->MiconwareSession->generateKey(); + $key = $this->MiconwareSession->generateKey(); + $data['User']['code'] = "a:".$key; + $data['User']['is_active'] = false; $result = $this->DreamjobCompany->registration($data); if($result){ - $result = $this->registrationMail($data); + $result = $this->registrationMail($data,$key); if($result){ $this->log("Registratrion Mail:"+$data['User']['mail']); } @@ -110,12 +112,14 @@ class RegistrationController extends AppController { $data['DreamjobWorker']['searchhidden'] = true; $data['DreamjobWorker']['workexperience'] = $this->request->data['DreamjobWorker']['workexperience']; - $data['User']['code'] = "a:".$this->MiconwareSession->generateKey(); + $key = $this->MiconwareSession->generateKey(); + $data['User']['code'] = "a:".$key; + $data['User']['is_active'] = false; $result = $this->DreamjobWorker->registration($data); if($result){ - $result = $this->registrationMail($data); + $result = $this->registrationMail($data,$key); if($result){ $this->log("Registratrion Mail:"+$data['User']['mail']); } @@ -139,6 +143,11 @@ class RegistrationController extends AppController { $this->set('error', 'dreamjob.error.loggedin'); $this->render('/Home/error'); } + + public function active(){ + $this->set('error', 'dreamjob.error.loggedin'); + $this->render('/Home/error'); + } } } ?> diff --git a/app/View/Emails/html/default.ctp b/app/View/Emails/html/default.ctp index e2bff19..fef4cfd 100755 --- a/app/View/Emails/html/default.ctp +++ b/app/View/Emails/html/default.ctp @@ -22,4 +22,7 @@ $content = explode("\n", $content); foreach ($content as $line): echo '
' . $line . "
\n"; endforeach; -?> \ No newline at end of file +foreach ($content as $line): + echo '' . $line . "
\n"; +endforeach; +?> diff --git a/app/View/Emails/text/default.ctp b/app/View/Emails/text/default.ctp index 090b5c4..9c9fda3 100755 --- a/app/View/Emails/text/default.ctp +++ b/app/View/Emails/text/default.ctp @@ -16,4 +16,4 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT License */ ?> - \ No newline at end of file +