password_reset.php 3.05 KB
<?php
/*
* Template Name:  Password Reset
*/
?>


<?php get_header(); ?>

<div id="homecontent" class="home-content">
	<div id="login-wrap">
		<div id="container">
			<h2>Password Reset</h2>
			<?php while (have_posts()) : the_post(); ?>




				<article id="page-<?php the_ID(); ?>" class="meta-box hentry">




					<div id="resetPassword">
						<div id="message"></div>
						<!--this check on the link key and user login/username-->
						<?php
						$errors = new WP_Error();
						$user = check_password_reset_key($_GET['key'], $_GET['login']);

						if (is_wp_error($user)) {
							if ($user->get_error_code() == 'expired_key')
								$errors->add(
									'expiredkey',
									__('Sorry, this key has expired.  To gain access to your account, <a href="https://thecommonwell.ca/lost-password/">request a password reset key.</a>')
								);
							else
								$errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
						}

						// display error message
						if ($errors->get_error_code()) {
							echo '<span style="color:red;">' . $errors->get_error_message($errors->get_error_code()) . '</span>';
						} else {
							?>

							<form id="resetPasswordForm" method="post" autocomplete="off">
								<?php
								// this prevent automated script for unwanted spam
								if (function_exists('wp_nonce_field'))
									wp_nonce_field('rs_user_reset_password_action', 'rs_user_reset_password_nonce');
								?>

								<input type="hidden" name="user_key" id="user_key" value="<?php echo esc_attr($_GET['key']); ?>" autocomplete="off" />
								<input type="hidden" name="user_login" id="user_login" value="<?php echo esc_attr($_GET['login']); ?>" autocomplete="off" />

								<p>
									<label for="pass1"><?php _e('New password') ?><br />
										<input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" /></label>
								</p>
								<p>
									<label for="pass2"><?php _e('Confirm new password') ?><br />
										<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /></label>
								</p>

								<p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).'); ?></p>

								<br class="clear" />

								<?php
								/**
								 * Fires following the 'Strength indicator' meter in the user password reset form.
								 *
								 * @since 3.9.0
								 *
								 * @param WP_User $user User object of the user whose password is being reset.
								 */
								do_action('resetpass_form', $user);
								?>
								<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" />

								</p>
							<?php } ?>
						</form>
					</div>

				</article>

			<?php endwhile; ?>

		</div><!-- .main-column -->

	</div>
</div>
<style>
	.error {
		color: red !important;

	}
</style>



<?php get_footer(); ?>