public function indexAction() { $objForm = new HTMLFORM($this, 'contact'); $objForm->setAction('contact/index'); $objForm->addField('Anliegen', 'input', 'subject', '', true, '', '', ''); $objForm->addField('Nachricht', 'textarea', 'message', '', true, '', '', ''); $objForm->addSubmitButton('Nachricht übermitteln'); $objForm->output(); if ($objForm->isSubmittedAndValid()) { $objDataCustomer = new GSALES_DATA_CUSTOMER(); $objCustomer = $objDataCustomer->getCustomerById($this->objUserAuth->getCustomerId()); $objMailer = new FRONTEND_MAILER(); $objMailer->FromName = trim($objCustomer->getFirstname() . ' ' . $objCustomer->getLastname()); $objMailer->From = $objCustomer->getEmail(); $objMailer->AddReplyTo($objCustomer->getEmail(), trim($objCustomer->getFirstname() . ' ' . $objCustomer->getLastname())); $objMailer->Subject = 'Kundenfrontend "' . $_POST['subject'] . '"'; $objMailer->Body = $_POST['message']; $objMailer->AddAddress(MAIL_TO); $booCheck = $objMailer->Send(); if ($booCheck) { $this->setMessage('Nachricht wurde erfolgreich verschickt'); $this->redirectTo('contact', 'index'); } else { $this->setMessage($objMailer->ErrorInfo, 'error'); } } }
public function passwordAction() { $objForm = new HTMLFORM($this, 'editpass'); $objForm->setAction('mydata/password'); $objForm->setConfirmField('password1', 'password2'); $objForm->addField('Neues Passwort', 'password', 'password1', '', true, 'password', '', ''); $objForm->addField('Neues Passwort bestätigen', 'password', 'password2', '', true, '', '', ''); $objForm->addSubmitButton('Passwort ändern'); $objForm->output(); if ($objForm->isSubmittedAndValid()) { $objDataCustomer = new GSALES_DATA_CUSTOMER(); $booResult = $objDataCustomer->saveUpdatedFrontendPassword($this->objUserAuth->getCustomerId(), $_POST['password1']); if (false == $booResult) { $this->setMessage('Das neue Passwort konnte nicht gespeichert werden', 'error'); return false; } $this->setMessage('Das neue Passwort wurde erfolgreich gespeichert'); $this->redirectTo('mydata', 'index'); } }
public function newpasswordAction() { $intCustomerId = false; $strToken = false; $arrUserRequest = $this->getUserRequest(); // check link or hidden post vars if (is_array($arrUserRequest['params'])) { if (count($arrUserRequest['params']) == 2) { $intCustomerId = $arrUserRequest['params'][0]; $strToken = $arrUserRequest['params'][1]; } } if (isset($_POST['cid'])) { $intCustomerId = $_POST['cid']; } if (isset($_POST['token'])) { $strToken = $_POST['token']; } if (false == $intCustomerId || false == $strToken) { $this->setMessage('Ungültiger Link', 'error'); $this->redirectTo('index', 'index'); return; } // check if customer exists $objDataCustomer = new GSALES_DATA_CUSTOMER(); $objCustomer = $objDataCustomer->getCustomerById($intCustomerId, true); if (false == $objCustomer) { $this->setMessage('Ungültiger Link', 'error'); $this->redirectTo('index', 'index'); return; } // check if token is correct if ($objCustomer->getFrontendPasswordLost() != $strToken) { $this->setMessage('Ungültiger Link', 'error'); $this->redirectTo('index', 'index'); return; } $objForm = new HTMLFORM($this, 'newpassword'); $objForm->setAction('index/newpassword'); $objForm->setConfirmField('password1', 'password2'); $objForm->setConfirmField('password1', 'password2'); $objForm->addField('Neues Passwort', 'password', 'password1', '', true, 'password', '', ''); $objForm->addField('Neues Passwort bestätigen', 'password', 'password2', '', true, '', '', ''); $objForm->addField('cid', 'hidden', 'cid', $intCustomerId); $objForm->addField('token', 'hidden', 'token', $strToken); $objForm->addSubmitButton('Neues Passwort speichern'); $objForm->output(); if ($objForm->isSubmittedAndValid()) { $booCheck = $objDataCustomer->saveUpdatedFrontendPassword($intCustomerId, $_POST['password1']); if ($booCheck) { $this->setMessage('Passwort wurde erfolgreich geändert'); $this->redirectTo('index', 'index'); } else { $this->setMessage('Passwort konnte aufgrund eines Programmfehlers nicht geändert werden', 'error'); } } }