first commit
This commit is contained in:
256
apps/backend/modules/stRemindPassword/actions/actions.class.php
Normal file
256
apps/backend/modules/stRemindPassword/actions/actions.class.php
Normal file
@@ -0,0 +1,256 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stRegister
|
||||
*
|
||||
* Ten plik należy do aplikacji stRegister opartej na licencji (Professional License SOTE).
|
||||
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
|
||||
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
|
||||
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
|
||||
*
|
||||
* @package stRegister
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: actions.class.php 1885 2009-06-26 13:15:49Z bartek $
|
||||
* @author Bartosz Alejski <bartosz.alejski@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modul prezentujacy mozliwosci klasy stRegister
|
||||
*
|
||||
* @package stRegister
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stRemindPasswordActions extends stActions
|
||||
{
|
||||
|
||||
public function executeCreateNewPassword()
|
||||
{
|
||||
|
||||
$this->passwordChange = 0;
|
||||
$hashCode = $this->getRequestParameter('hash_code');
|
||||
|
||||
if($hashCode)
|
||||
{
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserPeer::HASH_CODE, $hashCode);
|
||||
$user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
if($user)
|
||||
{
|
||||
|
||||
$this->login = $user->getUsername();
|
||||
|
||||
$this->hashCode = $hashCode;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$user->setPassword($this->getRequestParameter('remind[password1]'));
|
||||
|
||||
$user->save();
|
||||
|
||||
$this->passwordChange = 1;
|
||||
|
||||
//return $this->forward('stUser', 'confirmSendPassword');
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->redirect('/');
|
||||
}
|
||||
|
||||
}else{
|
||||
return $this->redirect('/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function validateCreateNewPassword()
|
||||
{
|
||||
$error_exists = false;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$validator = new stCaptchaGDValidator();
|
||||
|
||||
$validator->initialize($this->getContext(), array('captcha_error' => 'Wprowadzono zły numer.'));
|
||||
|
||||
$captcha = $this->getRequestParameter('captcha');
|
||||
|
||||
if (!$validator->execute($captcha, $error))
|
||||
{
|
||||
$this->getRequest()->setError('captcha', $error);
|
||||
|
||||
$error_exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
return !$error_exists;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function handleErrorCreateNewPassword()
|
||||
{
|
||||
|
||||
$hashCode = $this->getRequestParameter('hash_code');
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserPeer::HASH_CODE, $hashCode);
|
||||
$user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
$this->login = $user->getUsername();
|
||||
$this->hashCode = $hashCode;
|
||||
$this->passwordChange = 0;
|
||||
|
||||
return sfView::SUCCESS;
|
||||
}
|
||||
|
||||
public function executeRemind()
|
||||
{
|
||||
$this->send = false;
|
||||
|
||||
$this->setLayout(false);
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$email = $this->getRequestParameter('remind_email');
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserPeer::USERNAME , $email);
|
||||
$this->user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
if($this->user)
|
||||
{
|
||||
if($this->user->getHashCode()=="")
|
||||
{
|
||||
$this->user->setHashCode(md5(microtime()));
|
||||
$this->user->save();
|
||||
}
|
||||
|
||||
$this->send = $this->sendLinkToChangePasswordMail($email, $this->user->getHashCode());
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->send = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsługuje wysyłanie mail'i
|
||||
*/
|
||||
function sendLinkToChangePasswordMail($user, $hashCode)
|
||||
{
|
||||
$mail_error = $this->mailWithLinkToChangePassword($user, $hashCode);
|
||||
return $mail_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wysyła mail z zamówieniem do administratora
|
||||
*/
|
||||
function mailWithLinkToChangePassword($user, $hashCode)
|
||||
{
|
||||
|
||||
$mailHtmlHead = stMailer::getHtmlMailDescription("header");
|
||||
|
||||
$mailHtmlFoot = stMailer::getHtmlMailDescription("footer");
|
||||
|
||||
$sendLinkToPasswordToUserHtmlMailMessage = stMailTemplate::render('sendLinkToPasswordToUserHtml', array(
|
||||
'user' => $user,
|
||||
'hashCode' => $hashCode,
|
||||
'head' => $mailHtmlHead,
|
||||
'foot' => $mailHtmlFoot,
|
||||
'date' => date("d/m/Y")
|
||||
|
||||
));
|
||||
|
||||
$mailPlainHead = stMailer::getPlainMailDescription("header");
|
||||
|
||||
$mailPlainFoot = stMailer::getPlainMailDescription("footer");
|
||||
|
||||
$sendLinkToPasswordToUserPlainMailMessage = stMailTemplate::render('sendLinkToPasswordToUserPlain', array(
|
||||
'user' => $user,
|
||||
'hashCode' => $hashCode,
|
||||
'head' => $mailPlainHead,
|
||||
'foot' => $mailPlainFoot,
|
||||
'date' => date("d/m/Y")
|
||||
));
|
||||
|
||||
$mail = stMailer::getInstance();
|
||||
return $mail->setSubject($this->getRequest()->getHost().' - '.__('Link do zmiany hasła dla konta').": ".$user)->setHtmlMessage($sendLinkToPasswordToUserHtmlMailMessage)->setPlainMessage($sendLinkToPasswordToUserPlainMailMessage)->setTo($user)->sendToClient();
|
||||
|
||||
}
|
||||
|
||||
public function executeAjaxShow()
|
||||
{
|
||||
sfLoader::loadHelpers(array('Helper', 'stPartial'));
|
||||
|
||||
$form = st_get_component('stRemindPassword', 'remind');
|
||||
|
||||
return $this->renderText($form);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function handleErrorRemind()
|
||||
{
|
||||
return $this->executeAjaxShow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function validateRemind()
|
||||
{
|
||||
$error_exists = false;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$validator = new stCaptchaGDValidator();
|
||||
|
||||
$validator->initialize($this->getContext(), array('captcha_error' => 'Wprowadzono zły numer.'));
|
||||
|
||||
$captcha = $this->getRequestParameter('remind_captcha');
|
||||
|
||||
if (!$validator->execute($captcha, $error))
|
||||
{
|
||||
$this->getRequest()->setError('remind_captcha', $error);
|
||||
|
||||
$error_exists = true;
|
||||
}
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfGuardUserPeer::USERNAME , $this->getRequestParameter('remind_email'));
|
||||
|
||||
$user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
if(null === $user || !$user->hasGroup('admin'))
|
||||
{
|
||||
$this->getRequest()->setError('remind_email', $i18n->__('Nie ma takiego administratora.'));
|
||||
$error_exists = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return !$error_exists;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stRegister
|
||||
*
|
||||
* Ten plik należy do aplikacji stRegister opartej na licencji (Open License SOTE) Otwarta Licencja SOTE.
|
||||
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
|
||||
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
|
||||
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
|
||||
*
|
||||
* @package stRegister
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: components.class.php 251 2009-03-30 11:35:06Z marek $
|
||||
*/
|
||||
|
||||
class stRemindPasswordComponents extends sfComponents
|
||||
{
|
||||
public function executeRemind()
|
||||
{
|
||||
|
||||
}
|
||||
public function executeCreateNewPassword()
|
||||
{
|
||||
|
||||
$this->passwordChange = 0;
|
||||
$hashCode = $this->getRequestParameter('hash_code');
|
||||
|
||||
if($hashCode)
|
||||
{
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserPeer::HASH_CODE, $hashCode);
|
||||
$user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
if($user)
|
||||
{
|
||||
|
||||
$this->login = $user->getUsername();
|
||||
|
||||
$this->hashCode = $hashCode;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$user->setPassword($this->getRequestParameter('remind[password1]'));
|
||||
|
||||
$user->save();
|
||||
|
||||
$this->passwordChange = 1;
|
||||
|
||||
//return $this->forward('stUser', 'confirmSendPassword');
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->redirect('/');
|
||||
}
|
||||
|
||||
}else{
|
||||
return $this->redirect('/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function validateCreateNewPassword()
|
||||
{
|
||||
$error_exists = false;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$validator = new stCaptchaGDValidator();
|
||||
|
||||
$validator->initialize($this->getContext(), array('captcha_error' => 'Wprowadzono zły numer.'));
|
||||
|
||||
$captcha = $this->getRequestParameter('captcha');
|
||||
|
||||
if (!$validator->execute($captcha, $error))
|
||||
{
|
||||
$this->getRequest()->setError('captcha', $error);
|
||||
|
||||
$error_exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
return !$error_exists;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function handleErrorCreateNewPassword()
|
||||
{
|
||||
|
||||
$hashCode = $this->getRequestParameter('hash_code');
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserPeer::HASH_CODE, $hashCode);
|
||||
$user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
$this->login = $user->getUsername();
|
||||
$this->hashCode = $hashCode;
|
||||
$this->passwordChange = 0;
|
||||
|
||||
return sfView::SUCCESS;
|
||||
}
|
||||
|
||||
public function executeRemindPassword()
|
||||
{
|
||||
$this->send_true = 0;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserPeer::USERNAME , $this->getRequestParameter('remind[email]'));
|
||||
$user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
if($user)
|
||||
{
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfGuardGroupPeer::NAME , 'admin');
|
||||
$idUserGroupAdmin = sfGuardGroupPeer::doSelectOne($c);
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserGroupPeer::USER_ID , $user->getId());
|
||||
$c->add(sfGuardUserGroupPeer::GROUP_ID , $idUserGroupAdmin->getId());
|
||||
$userGroup = sfGuardUserGroupPeer::doSelectOne($c);
|
||||
|
||||
if($userGroup)
|
||||
{
|
||||
|
||||
if($user->getHashCode()=="")
|
||||
{
|
||||
$user->setHashCode(md5(microtime()));
|
||||
$user->save();
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$this->sendLinkToChangePasswordMail($this->getRequestParameter('remind[email]'), $user->getHashCode());
|
||||
} catch (Exception $e)
|
||||
{
|
||||
//@todo: add to log.
|
||||
}
|
||||
|
||||
$this->send_true = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->send_true = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->send_true = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsługuje wysyłanie mail'i
|
||||
*/
|
||||
function sendLinkToChangePasswordMail($user, $hashCode)
|
||||
{
|
||||
$mail_error = $this->mailWithLinkToChangePassword($user, $hashCode);
|
||||
return $mail_error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wysyła mail z zamówieniem do administratora
|
||||
*/
|
||||
function mailWithLinkToChangePassword($user, $hashCode)
|
||||
{
|
||||
|
||||
$mailHtmlHead = stMailer::getHtmlMailDescription("header");
|
||||
|
||||
$mailHtmlFoot = stMailer::getHtmlMailDescription("footer");
|
||||
|
||||
$sendLinkToPasswordToUserHtmlMailMessage = stMailTemplate::render('sendLinkToPasswordToUserHtml', array(
|
||||
'user' => $user,
|
||||
'hashCode' => $hashCode,
|
||||
'head' => $mailHtmlHead,
|
||||
'foot' => $mailHtmlFoot,
|
||||
'date' => date("Y-m-d H:i:s")
|
||||
|
||||
));
|
||||
|
||||
$mailPlainHead = stMailer::getPlainMailDescription("header");
|
||||
|
||||
$mailPlainFoot = stMailer::getPlainMailDescription("footer");
|
||||
|
||||
$sendLinkToPasswordToUserPlainMailMessage = stMailTemplate::render('sendLinkToPasswordToUserPlain', array(
|
||||
'user' => $user,
|
||||
'hashCode' => $hashCode,
|
||||
'head' => $mailPlainHead,
|
||||
'foot' => $mailPlainFoot,
|
||||
'date' => date("Y-m-d H:i:s")
|
||||
));
|
||||
|
||||
$mail = stMailer::getInstance();
|
||||
return $mail->setSubject($this->getRequest()->getHost().' - '.__('Link do zmiany hasła dla konta').": ".$user)->setHtmlMessage($sendLinkToPasswordToUserHtmlMailMessage)->setPlainMessage($sendLinkToPasswordToUserPlainMailMessage)->setTo($user)->sendToClient();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function handleErrorRemindPassword()
|
||||
{
|
||||
|
||||
$this->send_true = 0;
|
||||
return sfView::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uchwyt do walidatora edycji hasła.
|
||||
*/
|
||||
public function validateRemindPassword()
|
||||
{
|
||||
$error_exists = false;
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
|
||||
$validator = new stCaptchaGDValidator();
|
||||
|
||||
$validator->initialize($this->getContext(), array('captcha_error' => 'Wprowadzono zły numer.'));
|
||||
|
||||
$captcha = $this->getRequestParameter('captcha');
|
||||
|
||||
if (!$validator->execute($captcha, $error))
|
||||
{
|
||||
$this->getRequest()->setError('captcha', $error);
|
||||
|
||||
$error_exists = true;
|
||||
}
|
||||
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserPeer::USERNAME , $this->getRequestParameter('remind[email]'));
|
||||
$user = sfGuardUserPeer::doSelectOne($c);
|
||||
|
||||
if($user)
|
||||
{
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfGuardGroupPeer::NAME , 'admin');
|
||||
$idUserGroupAdmin = sfGuardGroupPeer::doSelectOne($c);
|
||||
|
||||
$c = new Criteria();
|
||||
$c->add(sfGuardUserGroupPeer::USER_ID , $user->getId());
|
||||
$c->add(sfGuardUserGroupPeer::GROUP_ID , $idUserGroupAdmin->getId());
|
||||
$userGroup = sfGuardUserGroupPeer::doSelectOne($c);
|
||||
|
||||
if(!$userGroup)
|
||||
{
|
||||
|
||||
$this->getRequest()->setError('remind{email}', $i18n->__('Nie ma takiego administratora.'));
|
||||
$error_exists = true;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->getRequest()->setError('remind{email}', $i18n->__('Nie ma takiego administratora.'));
|
||||
$error_exists = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return !$error_exists;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
27
apps/backend/modules/stRemindPassword/config/config.php
Normal file
27
apps/backend/modules/stRemindPassword/config/config.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stAuthUsers
|
||||
*
|
||||
* Ten plik należy do aplikacji stAuthUsers opartej na licencji (Open License SOTE) Otwarta Licencja SOTE.
|
||||
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
|
||||
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
|
||||
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
|
||||
*
|
||||
* @package stAuthUsers
|
||||
* @subpackage configs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/open (Open License SOTE) Otwarta Licencja SOTE
|
||||
* @version $Id: config.php 251 2009-03-30 11:35:06Z marek $
|
||||
* @author Marcin Olejniczak <marcin.olejniczak@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Włączanie modułów
|
||||
*/
|
||||
stPluginHelper::addEnableModule('stRemindPassword', 'backend');
|
||||
|
||||
/**
|
||||
* Dodawanie routingów
|
||||
*/
|
||||
stPluginHelper::addRouting('stRemindPassword', '/remindPassword/:action/*', 'stRemindPassword', 'remindPassword', 'backend');
|
||||
stPluginHelper::addRouting('stChangePassForAdmin', '/remindPassword/createNewPassword/:hash_code', 'stRemindPassword', 'createNewPassword', 'backend', array('confirm' => true));
|
||||
@@ -0,0 +1,2 @@
|
||||
all:
|
||||
is_secure: off
|
||||
@@ -0,0 +1,71 @@
|
||||
<br class="st_clear_all"/>
|
||||
<?php use_helper('I18N', 'Date', 'Text', 'stAdminGenerator', 'Object', 'Validation', 'ObjectAdmin', 'stCaptchaGD', 'stUrl') ?>
|
||||
|
||||
<?php use_stylesheet('backend/stRemindPassword.css'); ?>
|
||||
<?php echo st_get_admin_head(array('stRemindPassword', 'Przypomnij hasło'), __('Przypomnij hasło dla administratora'), __('Odzyskaj hasło dla konta administratora')) ?>
|
||||
|
||||
<?php if($passwordChange!=1): ?>
|
||||
<div id="st_remind">
|
||||
|
||||
<?php echo form_tag('stRemindPassword/createNewPassword', array('class' => 'st_form')) ?>
|
||||
<fieldset>
|
||||
<div id="st_form-remind-field1" class="st_row">
|
||||
<?php echo label_for('st_form-remind-field1',__('E-mail (login)')) ?>
|
||||
<div class="st_field">
|
||||
<?php echo form_error('remind[email]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')) ?>
|
||||
<?php echo input_tag('remind[email]', $login, array('id'=>'st_form-remind-email', 'maxlength'=>'255', 'disabled'=>'disabled')) ?>
|
||||
</div>
|
||||
<br class="st_clear_all">
|
||||
</div>
|
||||
|
||||
<div id="st_form-remind-field2" class="st_row" style="margin-top:3px;">
|
||||
<?php echo label_for('st_form-remind-field1',__('Nowe hasło')) ?>
|
||||
<div class="st_field">
|
||||
<?php echo form_error('remind[password1]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')) ?>
|
||||
<?php echo input_password_tag('remind[password1]', $sf_params->get('remind[password1]'), array('id'=>'st_form-remind-password1', 'maxlength'=>'255')) ?>
|
||||
</div>
|
||||
<br class="st_clear_all">
|
||||
</div>
|
||||
|
||||
<div id="st_form-remind-field3" class="st_row">
|
||||
<?php echo label_for('st_form-remind-field1',__('Potwierdź hasło')) ?>
|
||||
<div class="st_field">
|
||||
<?php echo form_error('remind[password2]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')) ?>
|
||||
<?php echo input_password_tag('remind[password2]', $sf_params->get('remind[password2]'), array('id'=>'st_form-remind-password2', 'maxlength'=>'255')) ?>
|
||||
</div>
|
||||
<br class="st_clear_all">
|
||||
</div>
|
||||
|
||||
<div id="st_form-remind-field4" class="st_row" style="margin-left:160px; height: 55px; margin-top:3px;">
|
||||
<?php echo get_captcha(); ?>
|
||||
</div>
|
||||
|
||||
<div id="st_form-remind-field5" class="st_row">
|
||||
<?php echo label_for('st_form-remind-field1',__('Cyfry z obrazka')) ?>
|
||||
<div class="st_field">
|
||||
<?php echo form_error('captcha', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')) ?>
|
||||
<?php echo input_tag('captcha', '', array('id'=>'st_form-remind-captcha', 'maxlength'=>'255')) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo input_hidden_tag('hash_code', $hashCode); ?>
|
||||
|
||||
<div id="st_form-remind-field4" class="st_row">
|
||||
<div id="submit_button">
|
||||
<?php echo st_get_admin_actions_head() ?>
|
||||
<?php echo st_get_admin_action(null, __('Zmień hasło'), null, 'name=save') ?>
|
||||
<?php echo st_get_admin_actions_foot() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div style="text-align: center; margin:100px;">
|
||||
<?php echo __('Hasło dla administratora zostało zmienione.'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo link_to(__('Powrót do strony logowania'),"/"); ?>
|
||||
<?php echo st_get_admin_foot() ?>
|
||||
36
apps/backend/modules/stRemindPassword/templates/_remind.php
Normal file
36
apps/backend/modules/stRemindPassword/templates/_remind.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php use_helper('stCaptchaGD') ?>
|
||||
<div id="password_reminder_form">
|
||||
<form action="<?php echo url_for('stRemindPassword/remind') ?>" method="post">
|
||||
<div class="remind_email<?php if ($sf_request->hasError('remind_email')): ?> form-error<?php endif; ?>">
|
||||
<input type="text" name="remind_email" id="remind_email" placeholder="Login / e-mail" value="<?php echo $sf_request->getParameter('remind_email') ?>" />
|
||||
<?php if ($sf_request->hasError('remind_email')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('remind_email') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="row<?php if ($sf_request->hasError('remind_captcha')): ?> form-error<?php endif; ?>">
|
||||
<div class="captcha">
|
||||
<?php echo get_captcha(); ?>
|
||||
<p><input type="text" name="remind_captcha" id="remind_captcha" value="" placeholder="<?php echo __('Wpisz cyfry z obrazka', null, 'sfGuardUser') ?>" /></p>
|
||||
<?php if ($sf_request->hasError('remind_captcha')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('remind_captcha') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="submit">
|
||||
<button type="submit"><?php echo __('Przypomnij') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$('#password_reminder_form > form').submit(function(event) {
|
||||
var form = $(this);
|
||||
$('#password_reminder_form').css({ visibility: 'hidden' });
|
||||
$.post(form.attr('action'), form.serializeArray(), function(html) {
|
||||
$('#password_reminder > .content').html(html);
|
||||
});
|
||||
event.preventDefault();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php use_helper('I18N', 'Date', 'Text', 'stAdminGenerator', 'Object', 'Validation', 'ObjectAdmin', 'stCaptchaGD', 'stUrl') ?>
|
||||
|
||||
|
||||
<div class="show_hide_contact_form"><span style="color: #4B7195; outline: medium none; text-decoration: underline;"><?php echo __('Przypomnij hasło') ?></span></div>
|
||||
<?php if ($sf_request->hasError('remind{email}') || $sf_request->hasError('captcha')): ?>
|
||||
<div class="slidingDiv_contact_form">
|
||||
<?php elseif ($sf_params->get('remind[email]')): ?>
|
||||
<div class="slidingDiv_contact_form">
|
||||
<?php else: ?>
|
||||
<div class="slidingDiv_contact_form" style="display:none;">
|
||||
<?php endif; ?>
|
||||
<?php echo form_tag('stRemindPassword/remindPassword', array('class' => 'sf_admin_config_form')) ?>
|
||||
<fieldset id="sf_fieldset-none" style="border: none;">
|
||||
<div class="st_fieldset-content" style="padding-bottom: 10px; padding-top: 10px;">
|
||||
<?php if($send_true!=1): ?>
|
||||
<div class="row" style="padding: 4px 10px;">
|
||||
<label for="remind_email" style="float: left; padding-right: 10px; text-align: right; width: 260px; color: #000000; font-weight: normal;"><?php echo __('E-mail (login):') ?></label>
|
||||
<div class="field<?php if ($sf_request->hasError('remind{email}')): ?> form-error<?php endif; ?>" style="float: left;">
|
||||
<?php if ($sf_request->hasError('remind{email}')): ?>
|
||||
<?php echo form_error('remind{email}', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('remind[email]', $sf_params->get('remind[email]'), array('maxlength'=>'255', 'size' =>'32')) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<div class="row" style="padding: 4px 10px;">
|
||||
<label for="remind_get_captcha" style="float: left; padding-right: 10px; text-align: right; width: 260px;"></label>
|
||||
<div class="field" style="margin-left: 94px;">
|
||||
<?php echo get_captcha(); ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
<div class="row" style="padding: 4px 10px;">
|
||||
<label for="captcha" style="float: left; padding-right: 10px; text-align: right; width: 260px; color: #000000; font-weight: normal;"><?php echo __('Cyfry z obrazka:') ?></label>
|
||||
<div class="field<?php if ($sf_request->hasError('captcha')): ?> form-error<?php endif; ?>" style="float: left;">
|
||||
<?php if ($sf_request->hasError('captcha')): ?>
|
||||
<?php echo form_error('captcha', array('class' => 'form-error-msg')) ?>
|
||||
<?php endif; ?>
|
||||
<?php echo input_tag('captcha', '', array('maxlength'=>'255', 'size' =>'32')) ?>
|
||||
</div>
|
||||
<div class="clr"></div>
|
||||
</div>
|
||||
|
||||
<div id="submit_login" align="center" style="clear: right; margin-left: 280px; padding-top: 10px;">
|
||||
<div id="submit_left"></div>
|
||||
<div id="submit_middle">
|
||||
<?php echo submit_tag(__('Przypomnij'), array('name' => 'remindPassword')); ?>
|
||||
<?php echo image_tag('backend/icons/arrow_right.gif') ?>
|
||||
</div>
|
||||
<div id="submit_right"></div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="slidingDiv_contact_form" style="text-align: center; margin-top:20px;">
|
||||
<?php echo __('E-mail z linkiem do utworzenia nowego hasła został wysłany na adres').":<b><br>".$sf_params->get('remind[email]')."</b>"; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<br class="st_clear_all" />
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(function ($)
|
||||
{
|
||||
$(document).ready(function(){
|
||||
$(".show_hide_contact_form").show();
|
||||
$('.show_hide_contact_form').click(function(){
|
||||
$( this ).next( ".slidingDiv_contact_form" ).slideToggle();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php use_helper('Date','stApplication') ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body style="background-color:#fff; font-family:Helvetica,Verdana,Arial,sans-serif; line-height:18px; font-size:1em;"><div style="margin: 0px auto; background-color:#fff;"><br><div style="width:700px; margin:0px auto;"><div style="background:url(http://<?php echo $sf_request->getHost(); ?>/images/frontend/theme/default/mail/frame_mail_top.png?version=1); height:30px"></div>
|
||||
|
||||
<div style="background-color:#fff; padding:0px 25px 0px 25px; border-left:1px solid #d0d2d8; border-right:1px solid #d0d2d8;">
|
||||
<div style="font-family:Verdana,Arial,Helvetica,sans-serif; line-height:18px; font-size:10px;">
|
||||
<?php echo @$user_head; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="min-height:400px; padding:0px 25px 0px 25px; text-align:justify; border-left:1px solid #d0d2d8; border-right:1px solid #d0d2d8;">
|
||||
|
||||
<div style="float:left;font-size:18px;color:#576278;">
|
||||
<?php echo __('Link do zmiany hasła dla konta').': '; ?>
|
||||
</div>
|
||||
|
||||
<div style="float:right; font-size:12px; color:#576278;">
|
||||
<?php echo __('Data wysłania linku').': '; ?> <span style="color:#404040;"><?php echo $date; ?><span>
|
||||
</div>
|
||||
|
||||
<br style="clear:both;"/>
|
||||
|
||||
<div style="margin:10px 0px 7px 0px">
|
||||
|
||||
<div style="font-family:Verdana,Arial,Helvetica,sans-serif; line-height:18px; font-size:10px;">
|
||||
<?php echo __('Skorzystaj z linku poniżej aby dokonać zmiany hasła.'); ?>
|
||||
</div>
|
||||
|
||||
<br style="clear:both">
|
||||
|
||||
<div style="height:20px;font-size:12px;color:#576278;">
|
||||
<?php echo link_to(__('Zmień hasło'), '@stChangePassForAdmin?hash_code=' . $hashCode, 'absolute=true'); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="background-color:#fff; padding:0px 25px 0px 25px; border-left:1px solid #d0d2d8; border-right:1px solid #d0d2d8;">
|
||||
<div style="font-family:Verdana,Arial,Helvetica,sans-serif; line-height:18px; font-size:10px;">
|
||||
<?php echo @$user_foot; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="background:url(http://<?php echo $sf_request->getHost(); ?>/images/frontend/theme/default/mail/frame_mail_bottom.png?version=1); height:30px"></div></div></div></body></html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php echo __('Link do zmiany hasła dla konta').': '; ?>
|
||||
|
||||
<?php echo __('Data wysłania linku').': '; ?><?php echo $date; ?>
|
||||
|
||||
<?php echo __('Skorzystaj z linku poniżej aby dokonać zmiany hasła.'); ?>
|
||||
|
||||
<?php echo link_to(__('Zmień hasło'), '@stChangePassForAdmin?hash_code=' . $hashCode, 'absolute=true'); ?>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php use_helper('Validation', 'I18N', 'stCaptchaGD') ?>
|
||||
<div id="password_reminded">
|
||||
<div class="login_form">
|
||||
<?php if($passwordChange!=1): ?>
|
||||
<div style='color: #000000; font-size: 16px; font-weight: normal; text-align: center; margin-bottom: 20px;'><?php echo __('Utwórz nowe hasło', null, 'stRemindPassword') ?></div>
|
||||
<?php echo form_tag('stRemindPassword/createNewPassword', array('class' => 'st_form')) ?>
|
||||
<div class="row<?php if ($sf_request->hasError('remind{email}')): ?> form-error<?php endif; ?>">
|
||||
<input type="text" name="remind[email]" id="remind[email]" placeholder="Login / e-mail" value="<?php echo $login ?>" />
|
||||
<?php if ($sf_request->hasError('remind{email}')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('remind[email]') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="row<?php if ($sf_request->hasError('remind{password1}')): ?> form-error<?php endif; ?>">
|
||||
<input type="password" name="remind[password1]" id="remind[password1]" placeholder="<?php echo __('Nowe hasło') ?>" />
|
||||
<?php if ($sf_request->hasError('remind{password1}')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('remind[password1]') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="row<?php if ($sf_request->hasError('remind{password2}')): ?> form-error<?php endif; ?>">
|
||||
<input type="password" name="remind[password2]" id="remind[password2]" placeholder="<?php echo __('Potwierdź hasło') ?>" />
|
||||
<?php if ($sf_request->hasError('remind{password2}')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('remind[password2]') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="row<?php if ($sf_request->hasError('captcha')): ?> form-error<?php endif; ?>">
|
||||
<div class="captcha">
|
||||
<?php echo get_captcha(); ?>
|
||||
<p><input type="text" name="captcha" id="captcha" value="" placeholder="<?php echo __('Wpisz cyfry z obrazka', null, 'sfGuardUser') ?>" /></p>
|
||||
<?php if ($sf_request->hasError('captcha')): ?>
|
||||
<div class="form-error-msg"><?php echo $sf_request->getError('captcha') ?> </div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo input_hidden_tag('hash_code', $hashCode); ?>
|
||||
<div class="submit">
|
||||
<button type="submit"><?php echo __('Zmień hasło') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<div class="logo">
|
||||
<img src="/images/backend/beta/logo.jpg" alt="" />
|
||||
</div>
|
||||
<div style="font-size: 14px; padding: 40px 0; text-align: center;">
|
||||
<?php echo __('Hasło dla administratora zostało zmienione.'); ?>
|
||||
</div>
|
||||
<div class="submit">
|
||||
<a href="/backend.php"><button type="submit"><?php echo __('Zamknij', null, 'sfGuardUser') ?></button></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,52 @@
|
||||
<br class="st_clear_all"/>
|
||||
<?php use_helper('I18N', 'Date', 'Text', 'stAdminGenerator', 'Object', 'Validation', 'ObjectAdmin', 'stCaptchaGD', 'stUrl') ?>
|
||||
|
||||
<?php use_stylesheet('backend/stRemindPassword.css'); ?>
|
||||
<?php echo st_get_admin_head(array('stRemindPassword', 'Przypomnij hasło'), __('Przypomnij hasło dla administratora'), __('Odzyskaj hasło dla konta administratora')) ?>
|
||||
|
||||
|
||||
<?php if($send_true!=1): ?>
|
||||
<div id="st_remind">
|
||||
|
||||
<?php echo form_tag('stRemindPassword/remindPassword', array('class' => 'st_form')) ?>
|
||||
<fieldset>
|
||||
<div id="st_form-remind-field1" class="st_row">
|
||||
<?php echo label_for('st_form-remind-field1',__('E-mail (login)')) ?>
|
||||
<div class="st_field">
|
||||
<?php echo form_error('remind[email]', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')) ?>
|
||||
<?php echo input_tag('remind[email]', $sf_params->get('remind[email]'), array('id'=>'st_form-remind-email', 'maxlength'=>'255')) ?>
|
||||
</div>
|
||||
<br class="st_clear_all">
|
||||
</div>
|
||||
|
||||
<div id="st_form-remind-field2" class="st_row" style="margin-left:160px; height: 50px; margin-top:3px;">
|
||||
<?php echo get_captcha(); ?>
|
||||
</div>
|
||||
|
||||
<div id="st_form-remind-field3" class="st_row">
|
||||
<?php echo label_for('st_form-remind-field1',__('Cyfry z obrazka')) ?>
|
||||
<div class="st_field">
|
||||
<?php echo form_error('captcha', array('suffix'=>'', 'prefix'=>'', 'class'=>'st_error')) ?>
|
||||
<?php echo input_tag('captcha', '', array('id'=>'st_form-remind-captcha', 'maxlength'=>'255')) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="st_form-remind-field4" class="st_row">
|
||||
<div id="submit_button">
|
||||
<?php echo st_get_admin_actions_head() ?>
|
||||
<?php echo st_get_admin_action(null, __('Przypomnij'), null, 'name=save') ?>
|
||||
<?php echo st_get_admin_actions_foot() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div style="text-align: center; margin:100px;">
|
||||
<?php echo __('E-mail z linkiem do utworzenia nowego hasła został wysłany na adres').":<b><br>".$sf_params->get('remind[email]')."</b>"; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo link_to(__('Powrót do strony logowania'),"/"); ?>
|
||||
<?php echo st_get_admin_foot() ?>
|
||||
@@ -0,0 +1,16 @@
|
||||
<div id="password_reminder_form">
|
||||
<div id="message">
|
||||
<?php if ($send): ?>
|
||||
<p class="message">
|
||||
<?php echo __('Na adres "%email%" zostało wysłane nowe hasło', array('%email%' => $user->getUsername())) ?>
|
||||
</p>
|
||||
<?php else: ?>
|
||||
<p class="message form-error-msg">
|
||||
<?php echo __('Nowe hasło nie zostało wysłane, ponieważ konto pocztowe sklepu nie jest skonfigurowane prawidłowo.') ?>
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="submit">
|
||||
<a href="/backend.php"><button type="submit"><?php echo __('Zamknij', null, 'sfGuardUser') ?></button></a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php use_helper('Date','stApplication') ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
</head>
|
||||
<body style="background-color:#f7f7f7; font-family:Helvetica,Verdana,Arial,sans-serif; line-height:18px; font-size:1em;">
|
||||
<div style="background-color:#f7f7f7; padding: 20px 0px;">
|
||||
<div style="width:700px; margin: 0px auto; text-align: right; color: #AAAAAA; font-size: 12px;">
|
||||
<?php echo $sf_request->getHost() ?> <?php echo $user; ?> <?php echo $date; ?>
|
||||
</div>
|
||||
<div style="width:700px; margin:10px auto; background-color:#fff; border: 1px solid #DDDDDD;">
|
||||
<div style="background-color:#fff;">
|
||||
<div style="line-height:18px; font-size:10px; color:#576278;">
|
||||
<?php echo @$user_head; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="min-height:300px;padding:25px;">
|
||||
|
||||
<div style="float:left;font-size:18px;color:#576278;">
|
||||
<?php echo __('Zmiana hasła'); ?>
|
||||
</div>
|
||||
|
||||
<br style="clear:both;"/>
|
||||
|
||||
<div style="margin:10px 0px 7px 0px">
|
||||
|
||||
<div style="font-size:13px; color:#576278; padding-top: 10px;">
|
||||
<?php echo __('Kliknij w poniższy link, żeby zmienić hasło. Zostaniesz przeniesiony na stronę z formularzem do zmiany hasła.'); ?>
|
||||
</div>
|
||||
|
||||
<br style="clear:both">
|
||||
|
||||
<div style="height:20px;font-size:12px;color:#576278;">
|
||||
<?php echo link_to(__('Zmień hasło').' > ', '@stChangePassForAdmin?hash_code=' . $hashCode, 'absolute=true'); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div style="background-color:#fff;">
|
||||
<div style="line-height:18px; font-size:10px; color:#576278;">
|
||||
<?php echo @$user_foot; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="border-bottom: 1px solid #DDDDDD;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php echo __('Link do zmiany hasła dla konta').': '; ?>
|
||||
|
||||
<?php echo __('Data wysłania linku').': '; ?><?php echo $date; ?>
|
||||
|
||||
<?php echo __('Skorzystaj z linku poniżej aby dokonać zmiany hasła.'); ?>
|
||||
|
||||
<?php echo link_to(__('Zmień hasło'), '@stChangePassForAdmin?hash_code=' . $hashCode, 'absolute=true'); ?>
|
||||
@@ -0,0 +1,24 @@
|
||||
fields:
|
||||
remind{password1}:
|
||||
required:
|
||||
msg: Brak hasła.
|
||||
|
||||
sfStringValidator:
|
||||
min: 6
|
||||
min_error: Podane hasło jest za krótkie min. 6 znaków.
|
||||
max: 20
|
||||
max_error: Przekroczono dozwoloną liczbę znaków.
|
||||
|
||||
remind{password2}:
|
||||
required:
|
||||
msg: Brak hasła.
|
||||
|
||||
sfStringValidator:
|
||||
min: 6
|
||||
min_error: Podane hasło jest za krótkie min. 6 znaków.
|
||||
max: 20
|
||||
max_error: Przekroczono dozwoloną liczbę znaków.
|
||||
|
||||
sfCompareValidator:
|
||||
check: remind[password1]
|
||||
compare_error: Hasła nie są takie same.
|
||||
@@ -0,0 +1,11 @@
|
||||
fields:
|
||||
remind{email}:
|
||||
required:
|
||||
msg: Brak adresu e-mail
|
||||
|
||||
sfStringValidator:
|
||||
max: 40
|
||||
max_error: Przekroczono dozwoloną liczbę znaków.
|
||||
|
||||
sfEmailValidator:
|
||||
email_error: Nieprawidłowy format adresu e-mail.
|
||||
Reference in New Issue
Block a user