auth.html 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. {extend name="default/base/base_member" /}
  2. {block name="member_main"}
  3. <div class="alert alert-success">
  4. <h4>{$Think.lang.operating_hints}:</h4>
  5. <ul>
  6. <li>{$Think.lang.binding_information1}</li>
  7. <li>{$Think.lang.binding_information2} <a href="{:url('Membersecurity/auth',['type'=>'modify_mobile'])}">{$Think.lang.binding_information3}</a> {$Think.lang.binding_information4}</li>
  8. <li>{$Think.lang.binding_information5} <a href="{:url('Membersecurity/auth',['type'=>'modify_email'])}">{$Think.lang.binding_information6}</a> {$Think.lang.binding_information7}</li>
  9. <li>{$Think.lang.binding_information8}</li>
  10. <li>{$Think.lang.binding_information9}</li>
  11. </ul>
  12. </div>
  13. <div class="dsm-default-form">
  14. <form method="post" id="auth_form" action="">
  15. <input type="hidden" name="type" value="{$Request.param.type}">
  16. <dl>
  17. <dt><i class="required">*</i>{$Think.lang.select_authentication_method}:</dt>
  18. <dd><p>
  19. <select name="auth_type" id="auth_type">
  20. {if $member_info.member_mobile}
  21. <option value="mobile">{$Think.lang.mobile} [{:encrypt_show($member_info['member_mobile'],4,4)}]</option>
  22. {/if}
  23. {if $member_info.member_email}
  24. <option value="email">{$Think.lang.email} [{:encrypt_show($member_info['member_email'],4,4)}]</option>
  25. {/if}
  26. </select>
  27. <a href="javascript:void(0);" id="send_auth_code" class="dsm-btn ml5"><span id="sending" style="display:none">{$Think.lang.binding_validation_information1}</span><span class="send_success_tips"><strong id="show_times" class="red mr5"></strong>{$Think.lang.binding_validation_information2}</span>{$Think.lang.binding_validation_information3}</a></p>
  28. <p class="send_success_tips hint mt10">{$Think.lang.binding_validation_information4}<strong>{$Think.lang.binding_validation_information5}</strong>{$Think.lang.binding_validation_information6}</p>
  29. </dd>
  30. </dl>
  31. <dl>
  32. <dt><i class="required">*</i>{$Think.lang.binding_validation_information7}:</dt>
  33. <dd>
  34. <input type="text" class="text" maxlength="6" value="" name="auth_code" size="10" id="auth_code" autocomplete="off" />
  35. <label for="auth_code" generated="true" class="error"></label>
  36. </dd>
  37. </dl>
  38. <dl class="bottom">
  39. <dt>&nbsp;</dt>
  40. <dd>
  41. <input type="button" class="submit" value="{$Think.lang.binding_validation_information8}" />
  42. </dd>
  43. </dl>
  44. </form>
  45. </div>
  46. <script type="text/javascript">
  47. $('.send_success_tips').hide();
  48. var ALLOW_SEND = true;
  49. $(function() {
  50. $('.submit').on('click', function() {
  51. if (!$('#auth_form').valid()) {
  52. document.getElementById('codeimage').src = HOMESITEURL+'/Seccode/makecode.html?t=' + Math.random();
  53. } else {
  54. $('#auth_form').submit();
  55. }
  56. });
  57. function StepTimes() {
  58. $num = parseInt($('#show_times').html());
  59. $num = $num - 1;
  60. $('#show_times').html($num);
  61. if ($num <= 0) {
  62. ALLOW_SEND = !ALLOW_SEND;
  63. $('.send_success_tips').hide();
  64. } else {
  65. setTimeout(StepTimes, 1000);
  66. }
  67. }
  68. $('#send_auth_code').on('click', function() {
  69. if (!ALLOW_SEND)
  70. return;
  71. ALLOW_SEND = !ALLOW_SEND;
  72. $('#sending').show();
  73. $.getJSON("{:url('Membersecurity/send_auth_code')}", {type: $('#auth_type').val()}, function(data) {
  74. if (data.state == 'true') {
  75. $('#sending').hide();
  76. $('#show_times').html(60);
  77. $('.send_success_tips').show();
  78. setTimeout(StepTimes, 1000);
  79. } else {
  80. ALLOW_SEND = !ALLOW_SEND;
  81. $('#sending').hide();
  82. layer.alert(data.msg);
  83. }
  84. });
  85. });
  86. $('#auth_form').validate({
  87. rules: {
  88. auth_code: {
  89. required: true,
  90. maxlength: 6,
  91. minlength: 6,
  92. digits: true
  93. },
  94. captcha: {
  95. required: true,
  96. minlength: 4,
  97. remote: {
  98. url: "{:url('Seccode/check')}",
  99. type: 'get',
  100. data: {
  101. captcha: function() {
  102. return $('#captcha').val();
  103. }
  104. }
  105. }
  106. }
  107. },
  108. messages: {
  109. auth_code: {
  110. required: '<i class="iconfont">&#xe64c;</i>{$Think.lang.input_verification_code}',
  111. maxlength: '<i class="iconfont">&#xe64c;</i>{$Think.lang.input_verification_code}',
  112. minlength: '<i class="iconfont">&#xe64c;</i>{$Think.lang.input_verification_code}',
  113. digits: '<i class="iconfont">&#xe64c;</i>{$Think.lang.input_verification_code}'
  114. },
  115. captcha: {
  116. required: '<i class="iconfont">&#xe64c;</i>{$Think.lang.enter_graphic_verification_code}',
  117. minlength: '<i class="iconfont">&#xe64c;</i>{$Think.lang.enter_graphic_verification_code}',
  118. remote: '<i class="iconfont">&#xe64c;</i>{$Think.lang.enter_graphic_verification_code}'
  119. }
  120. }
  121. });
  122. });
  123. </script>
  124. {/block}