Guest User

Problemas com login de usuários

a guest
Nov 9th, 2017
190
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php // https://br.wordpress.org/support/topic/problemas-com-login-de-usuarios/ ?>
  2. <?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
  3. <?php
  4. /*
  5. Template Name: Login Page
  6. */
  7.  
  8. $mycars_page_link = get_permalink(TMM::get_option('user_cars_page', TMM_APP_CARDEALER_PREFIX));
  9. $redirect_url = !empty($mycars_page_link) ? $mycars_page_link : home_url();
  10. if (is_user_logged_in()) {
  11. wp_redirect($redirect_url, 302);
  12. return;
  13. }
  14.  
  15. get_header();
  16. global $post;
  17. global $wp;
  18. $lost_pass = false;
  19.  
  20. if ( isset($wp->query_vars['lost-password']) ) {
  21. $lost_pass = 'lost_password';
  22. }
  23.  
  24. ?>
  25.  
  26. <section class="viewport-50 padding-top-40 padding-bottom-80 clearfix">
  27.  
  28. <?php
  29. if (have_posts()) : while (have_posts()) : the_post(); ?>
  30. <?php if (!is_front_page() && !TMM_Helper::is_front_lang_page()): ?>
  31.  
  32. <?php if (!($hide_single_page_title = get_post_meta($post->ID, 'hide_single_page_title', true))): ?>
  33. <h2 class="section-title"><?php $lost_pass ? _e('Lost Password', 'cardealer') : the_title() ?></h2>
  34. <?php endif; ?>
  35. <?php endif; ?>
  36.  
  37. <?php
  38. the_content();
  39. tmm_link_pages();
  40. tmm_layout_content(get_the_ID());
  41. endwhile;
  42. endif;
  43.  
  44. if ($lost_pass) {
  45. $key = '';
  46. $login = '';
  47. $login_page_id = TMM::get_option('user_login_page', TMM_APP_CARDEALER_PREFIX);
  48.  
  49. if ( !empty($_GET['key']) && !empty($_GET['login']) ) {
  50.  
  51. $user = TMM_Ext_Authentication::check_password_reset_key( $_GET['key'], $_GET['login'] );
  52. $lost_pass = 'reset_password';
  53.  
  54. if( is_object( $user ) ) {
  55. $key = esc_attr($_GET['key']);
  56. $login = esc_attr($_GET['login']);
  57. }
  58.  
  59. } elseif ( isset( $_GET['reset'] ) ) {
  60. ?>
  61.  
  62. <div class="info"><?php echo __( 'Your password has been reset.', 'cardealer' ) . ' ' . __( 'Log in', 'cardealer' ) . ''; ?></div>
  63.  
  64. <?php
  65. }
  66. ?>
  67.  
  68. <!-- Lost Password Form -->
  69. <div class="row">
  70.  
  71. <div class="col-md-6<?php if ($lost_pass === 'lost_password'): ?> col-md-push-3<?php endif; ?>">
  72.  
  73. <div class="form-account">
  74.  
  75. <form method="post" name="lostpasswordform" id="lostpasswordform">
  76.  
  77. <?php if ($lost_pass === 'lost_password') { ?>
  78.  
  79. <div class="form-heading">
  80. <h3><?php _e('Restore Password', 'cardealer'); ?></h3>
  81. </div><!--/ .form-heading-->
  82.  
  83. <div class="form-entry clearfix">
  84.  
  85. <p><?php _e( 'Please enter your username or email address. You will receive a link to create a new password via email.', 'cardealer' ); ?></p>
  86.  
  87. <p>
  88. <label for="user_login"><?php _e( 'Username or email', 'cardealer' ); ?></label>
  89. <input class="input" type="text" size="20" value="" name="user_login" id="user_login" />
  90. </p>
  91.  
  92. <p>
  93. <input type="submit" class="button orange" value="<?php _e( 'Reset Password', 'cardealer' ); ?>" />
  94. </p>
  95.  
  96. <?php wp_nonce_field( $lost_pass ); ?>
  97.  
  98. </div><!--/ .form-entry-->
  99.  
  100. <?php } else if ($lost_pass === 'reset_password') { ?>
  101.  
  102. <div class="form-entry clearfix">
  103.  
  104. <?php if( is_object( $user ) ) { ?>
  105.  
  106. <p><?php _e( 'Enter a new password below.', 'cardealer'); ?></p>
  107.  
  108. <p>
  109. <label for="password_1"><?php _e( 'New password', 'cardealer' ); ?> <span class="required">*</span></label>
  110. <input type="password" size="20" value="" name="password_1" id="password_1" />
  111. </p>
  112. <p>
  113. <label for="password_2"><?php _e( 'Re-enter new password', 'cardealer' ); ?> <span class="required">*</span></label>
  114. <input type="password" size="20" value="" name="password_2" id="password_2" />
  115. </p>
  116.  
  117. <input type="hidden" name="reset_key" value="<?php echo $key; ?>" />
  118. <input type="hidden" name="reset_login" value="<?php echo $login; ?>" />
  119.  
  120. <p>
  121. <input type="submit" class="button orange" value="<?php _e( 'Save', 'cardealer' ); ?>" />
  122. </p>
  123.  
  124. <?php wp_nonce_field( $lost_pass ); ?>
  125.  
  126. <?php do_action('tmm_notice'); ?>
  127.  
  128. <?php } else { ?>
  129.  
  130. <div class="error"><?php echo (string) $user; ?></div>
  131.  
  132. <?php } ?>
  133.  
  134. </div><!--/ .form-entry-->
  135.  
  136. <?php } ?>
  137.  
  138. </form>
  139.  
  140. </div>
  141.  
  142. </div>
  143.  
  144. </div><!--/ .row-->
  145.  
  146. <?php
  147. } else {
  148.  
  149. $users_can_register = get_option('users_can_register');
  150.  
  151. if (isset($_GET['redirect']) AND ! empty($_GET['redirect'])) {
  152. $redirect_to = $_GET['redirect'];
  153. } else {
  154. $redirect_to = $redirect_url;
  155. }
  156. ?>
  157.  
  158. <!-- User Registration Form -->
  159. <div class="row">
  160.  
  161. <?php if ($users_can_register): ?>
  162.  
  163. <div class="col-md-6">
  164.  
  165. <div class="form-account">
  166.  
  167. <div class="form-heading">
  168. <h3><?php _e('Register now for', 'cardealer'); ?> <?php echo bloginfo() ?></h3>
  169. </div><!--/ .form-heading-->
  170.  
  171. <div class="form-entry clearfix">
  172.  
  173. <p>
  174. <label><?php _e('Username', 'cardealer'); ?>:</label>
  175. <input type="text" size="20" value="" class="input" id="user_name2" name="user_login">
  176. </p>
  177. <p>
  178. <label><?php _e('Your Email', 'cardealer'); ?>:</label>
  179. <input type="text" size="25" value="" class="input" id="user_email2" name="user_email">
  180. </p>
  181.  
  182. <p class="line_height_plus">
  183. <?php _e('A password will be e-mailed you.', 'cardealer'); ?>
  184. </p>
  185.  
  186. <input id="user_register_button2" type="submit" class="button dark enter-btn" value="<?php _e('Register', 'cardealer'); ?>"/>
  187.  
  188. <div id="register-info2" class="info"></div>
  189.  
  190. </div><!--/ .form-entry-->
  191.  
  192. </div><!--/ .form-account-->
  193.  
  194. </div>
  195.  
  196. <?php endif; ?>
  197.  
  198. <div class="col-md-6<?php if (!$users_can_register): ?> col-md-push-3<?php endif; ?>">
  199.  
  200. <div class="form-account">
  201.  
  202. <form method="post" action="<?php echo wp_login_url($redirect_to); ?>" id="loginform" name="loginform">
  203.  
  204. <div class="form-heading">
  205. <h3><?php _e('Log In', 'cardealer'); ?></h3>
  206. </div><!--/ .form-heading-->
  207.  
  208. <div class="form-entry clearfix">
  209.  
  210. <p>
  211. <label for="user_login"><?php _e('Username', 'cardealer'); ?>:</label>
  212. <input type="text" size="20" value="" class="input" id="user_login" name="log">
  213. </p>
  214. <p>
  215. <label for="user_pass"><?php _e('Password', 'cardealer'); ?>:</label>
  216. <input type="password" size="20" value="" class="input" id="user_pass" name="pwd">
  217. </p>
  218. <p class="line_height_plus">
  219. <input type="checkbox" value="forever" id="rememberme" name="rememberme">
  220. <label for="rememberme"><?php _e('Remember Me', 'cardealer'); ?></label>
  221. </p>
  222. <input type="submit" class="button orange" value="<?php _e('Login', 'cardealer'); ?>" id="wp-submit" name="wp-submit">
  223.  
  224. "><?php _e("Forgot your password?", 'cardealer') ?>
  225.  
  226. <input type="hidden" value="<?php echo $redirect_to ?>" name="redirect_to">
  227.  
  228. </div><!--/ .form-entry-->
  229.  
  230. </form>
  231.  
  232. </div><!--/ .form-account-->
  233.  
  234. </div>
  235.  
  236. </div><!--/ .row-->
  237.  
  238. <?php
  239. } ?>
  240.  
  241. </section>
  242.  
  243. <?php get_footer(); ?>
RAW Paste Data