forgotpassword.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. /**
  3. * FecShop file.
  4. *
  5. * @link http://www.fecshop.com/
  6. * @copyright Copyright (c) 2016 FecShop Software LLC
  7. * @license http://www.fecshop.com/license/
  8. */
  9. ?>
  10. <div class="main container one-column">
  11. <?= Yii::$service->page->widget->render('breadcrumbs',$this); ?>
  12. <?= Yii::$service->page->widget->render('flashmessage'); ?>
  13. <div class="account-create">
  14. <div class="page-title">
  15. <h1><?= Yii::$service->page->translate->__('Forgot Password'); ?></h1>
  16. </div>
  17. <form action="<?= Yii::$service->url->getUrl('customer/account/forgotpasswordsubmit'); ?>" method="post" id="form-validate">
  18. <div class="fieldset" style="width:auto">
  19. <h2 class="legend"><?= Yii::$service->page->translate->__('Confirm your identity to reset password'); ?></h2>
  20. <ul class="form-list">
  21. <li>
  22. <label for="email_address" class="required"><em>*</em><?= Yii::$service->page->translate->__('Email Address'); ?></label>
  23. <div class="input-box">
  24. <input name="editForm[email]" id="email_address" value="<?= $email ?>" title="Email Address" class="input-text validate-email required-entry" type="text">
  25. </div>
  26. </li>
  27. <?php if($forgotCaptcha): ?>
  28. <li>
  29. <div class="field">
  30. <label for="captcha" class="required"><em>*</em><?= Yii::$service->page->translate->__('Captcha'); ?></label>
  31. <div class="input-box forgot-captha register-captcha ">
  32. <input type="text" name="editForm[captcha]" value="" size=10 class="login-captcha-input required-entry">
  33. <img class="login-captcha-img" title="click refresh" src="<?= Yii::$service->url->getUrl('site/helper/captcha'); ?>?<?php echo md5(time() . mt_rand(1,10000));?>" align="absbottom" onclick="this.src='<?= Yii::$service->url->getUrl('site/helper/captcha'); ?>?'+Math.random();"></img>
  34. <i class="refresh-icon"></i>
  35. <div class="clear"></div>
  36. </div>
  37. <script>
  38. <?php $this->beginBlock('forgot_password_captcha_onclick_refulsh') ?>
  39. $(document).ready(function(){
  40. $(".refresh-icon").click(function(){
  41. $(this).parent().find("img").click();
  42. });
  43. });
  44. <?php $this->endBlock(); ?>
  45. </script>
  46. <?php $this->registerJs($this->blocks['forgot_password_captcha_onclick_refulsh'],\yii\web\View::POS_END);//将编写的js代码注册到页面底部 ?>
  47. </div>
  48. </li>
  49. <?php endif; ?>
  50. </ul>
  51. </div>
  52. <?= \fec\helpers\CRequest::getCsrfInputHtml(); ?>
  53. <div class="buttons-set">
  54. <button type="button" id="js_registBtn" class="redBtn"><em><span><i></i><?= Yii::$service->page->translate->__('Submit'); ?></span></em></button>
  55. <p class="back-link"><a href="<?= Yii::$service->url->getUrl('customer/account/login'); ?>" class="back-link"><small>« </small><?= Yii::$service->page->translate->__('Back'); ?></a></p>
  56. </div>
  57. <div class="clear"></div>
  58. </form>
  59. </div>
  60. </div>
  61. <?php
  62. $requiredValidate = 'This is a required field.';
  63. $emailFormatValidate = 'Please enter a valid email address. For example johndoe@domain.com.';
  64. ?>
  65. <script>
  66. <?php $this->beginBlock('forgot_password') ?>
  67. $(document).ready(function(){
  68. $("#js_registBtn").click(function(){
  69. validate = 1;
  70. $(".validation-advice").remove();
  71. $(".validation-failed").removeClass("validation-failed");
  72. var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
  73. // empty check
  74. $(".account-create .required-entry").each(function(){
  75. val = $(this).val();
  76. if(!val){
  77. $(this).addClass("validation-failed");
  78. $(this).parent().append('<div class="validation-advice" id="advice-required-entry-firstname" style=""><?= $requiredValidate; ?></div>');
  79. validate = 0;
  80. }
  81. });
  82. // email check
  83. $(".account-create .validate-email").each(function(){
  84. email = $(this).val();
  85. if(email){
  86. if(!$(this).hasClass("validation-failed")){
  87. if(!myreg.test(email)){
  88. $(this).parent().append('<div class="validation-advice" id="advice-validate-email-email_address" style=""><?= $emailFormatValidate; ?></div>');
  89. $(this).addClass("validation-failed");
  90. validate = 0;
  91. }
  92. }
  93. }else{
  94. validate = 0;
  95. }
  96. });
  97. if(validate){
  98. $(this).addClass("dataUp");
  99. $("#form-validate").submit();
  100. }
  101. });
  102. });
  103. <?php $this->endBlock(); ?>
  104. </script>
  105. <?php $this->registerJs($this->blocks['forgot_password'],\yii\web\View::POS_END);//将编写的js代码注册到页面底部 ?>