erste Mailversuche + registration sollte fertig sein + auser aktivierung

This commit is contained in:
Martin Müller 2014-04-08 19:47:05 +02:00
parent 34f07e3120
commit 78893148eb
5 changed files with 24 additions and 11 deletions

View File

@ -51,8 +51,8 @@ class EmailConfig {
'from' => array('noreply@dreamjob.cc'=>'Dreamjob-Site'), 'from' => array('noreply@dreamjob.cc'=>'Dreamjob-Site'),
'replyTo' => array('service@dreamjob.cc'=>'[Dreamjob] Service'), 'replyTo' => array('service@dreamjob.cc'=>'[Dreamjob] Service'),
'emailFormat'=>'both', 'emailFormat'=>'both',
'charset' => 'utf-8', //'charset' => 'utf-8',
'headerCharset' => 'utf-8', //'headerCharset' => 'utf-8',
); );
public $smtp = array( public $smtp = array(

View File

@ -34,6 +34,7 @@
Router::connect('/registration', array('controller' => 'registration', 'action' => 'main')); Router::connect('/registration', array('controller' => 'registration', 'action' => 'main'));
Router::connect('/registration/user', array('controller' => 'registration', 'action' => 'worker')); Router::connect('/registration/user', array('controller' => 'registration', 'action' => 'worker'));
Router::connect('/registration/company', array('controller' => 'registration', 'action' => 'company')); 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', array('controller' => 'user', 'action' => 'profil'));
Router::connect('/profil/page/:page', array('controller' => 'user', 'action' => 'profil'),array("page" => "[0-9]+")); Router::connect('/profil/page/:page', array('controller' => 'user', 'action' => 'profil'),array("page" => "[0-9]+"));

View File

@ -13,12 +13,12 @@ class RegistrationController extends AppController {
public $componens = array('Email','MiconwareSession'); public $componens = array('Email','MiconwareSession');
public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany'); public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany');
private function registrationMail($data){ private function registrationMail($data,$key){
$Email = new CakeEmail('dreamjobMain'); $Email = new CakeEmail('dreamjobMain');
$Email->to($data['User']['mail']); $Email->to($data['User']['mail']);
$Email->subject('Welcome to our really cool thing'); $Email->subject('Welcome to our really cool thing');
$Email->template('simple_message'); $Email->template('registration');
$Email->viewVars(array('data'=>$data)); $Email->viewVars(array('data'=>$data,'key'=>$key));
return $Email->send(); return $Email->send();
} }
@ -56,11 +56,13 @@ class RegistrationController extends AppController {
$data['DreamjobCompany']['bank_details'] = ''; $data['DreamjobCompany']['bank_details'] = '';
//$data['DreamjobCompany']['bank_details'] = $this->request->data['DreamjobCompany']['bank_details']; //$data['DreamjobCompany']['bank_details'] = $this->request->data['DreamjobCompany']['bank_details'];
$data['DreamjobCompany']['website'] = $this->request->data['DreamjobCompany']['website']; $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); $result = $this->DreamjobCompany->registration($data);
if($result){ if($result){
$result = $this->registrationMail($data); $result = $this->registrationMail($data,$key);
if($result){ if($result){
$this->log("Registratrion Mail:"+$data['User']['mail']); $this->log("Registratrion Mail:"+$data['User']['mail']);
} }
@ -110,12 +112,14 @@ class RegistrationController extends AppController {
$data['DreamjobWorker']['searchhidden'] = true; $data['DreamjobWorker']['searchhidden'] = true;
$data['DreamjobWorker']['workexperience'] = $this->request->data['DreamjobWorker']['workexperience']; $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); $result = $this->DreamjobWorker->registration($data);
if($result){ if($result){
$result = $this->registrationMail($data); $result = $this->registrationMail($data,$key);
if($result){ if($result){
$this->log("Registratrion Mail:"+$data['User']['mail']); $this->log("Registratrion Mail:"+$data['User']['mail']);
} }
@ -139,6 +143,11 @@ class RegistrationController extends AppController {
$this->set('error', 'dreamjob.error.loggedin'); $this->set('error', 'dreamjob.error.loggedin');
$this->render('/Home/error'); $this->render('/Home/error');
} }
public function active(){
$this->set('error', 'dreamjob.error.loggedin');
$this->render('/Home/error');
}
} }
} }
?> ?>

View File

@ -22,4 +22,7 @@ $content = explode("\n", $content);
foreach ($content as $line): foreach ($content as $line):
echo '<p> ' . $line . "</p>\n"; echo '<p> ' . $line . "</p>\n";
endforeach; endforeach;
?> foreach ($content as $line):
echo '<p> ' . $line . "</p>\n";
endforeach;
?>

View File

@ -16,4 +16,4 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License * @license http://www.opensource.org/licenses/mit-license.php MIT License
*/ */
?> ?>
<?php echo $content; ?> <?php echo $content.$content; ?>