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'); } } }