File: /mnt/data/truelysell-wp/pet-grooming/wp-content/themes/truelysell/template-parts/template-login.php
<?php
/**
* Template Name: Login Page
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package Truelysell
*/
if (!is_user_logged_in()) {
$not_verified = isset($_GET['not_verified']) ? sanitize_text_field($_GET['not_verified']) : '';
$errors = array();
if (isset($_REQUEST['login'])) {
$error_codes = explode(',', $_REQUEST['login']);
foreach ($error_codes as $code) {
switch ($code) {
case 'empty_username':
$errors[] = esc_html__('You do have an email address, right?', 'truelysell');
break;
case 'empty_password':
$errors[] = esc_html__('You need to enter a password to login.', 'truelysell');
break;
case 'username_exists':
$errors[] = esc_html__('This username already exists.', 'truelysell');
break;
case 'authentication_failed':
case 'invalid_username':
$errors[] = esc_html__(
"We don't have any users with that email address. Maybe you used a different one when signing up?",
'truelysell'
);
break;
case 'invalid_email':
$errors[] = esc_html__("Please check email or username correct?",'truelysell');
break;
case 'incorrect_password':
$err = __(
"The password you entered wasn't quite right.",
'truelysell'
);
$errors[] = sprintf($err, wp_lostpassword_url());
break;
default:
break;
}
}
}
// Retrieve possible errors from request parameters
if (isset($_REQUEST['register-errors'])) {
$error_codes = explode(',', $_REQUEST['register-errors']);
foreach ($error_codes as $error_code) {
switch ($error_code) {
case 'email':
$errors[] = esc_html__('The email address you entered is not valid.', 'truelysell');
break;
case 'email_exists':
$errors[] = esc_html__('An account exists with this email address.', 'truelysell');
break;
case 'closed':
$errors[] = esc_html__('Registering new users is currently not allowed.', 'truelysell');
break;
case 'captcha-no':
$errors[] = esc_html__('Please check reCAPTCHA checbox to register.', 'truelysell');
break;
case 'username_exists':
$errors[] = esc_html__('This username already exists.', 'truelysell');
break;
case 'captcha-fail':
$errors[] = esc_html__("You're a bot, aren't you?.", 'truelysell');
break;
case 'policy-fail':
$errors[] = esc_html__("Please accept the Privacy Policy to register account.", 'truelysell');
break;
case 'terms-fail':
$errors[] = esc_html__("Please accept the Terms and Conditions to register account.", 'truelysell');
break;
case 'first_name':
$errors[] = esc_html__("Please provide your first name", 'truelysell');
break;
case 'last_name':
$errors[] = esc_html__("Please provide your last name", 'truelysell');
break;
case 'empty_user_login':
$errors[] = esc_html__("Please provide your user login", 'truelysell');
break;
case 'password-no':
$errors[] = esc_html("You have forgot about password.", 'truelysell', 'truelysell');
break;
case 'incorrect_password':
$err = __(
"The password you entered wasn't quite right. ",
'truelysell'
);
$errors[] = sprintf($err, wp_lostpassword_url());
break;
default:
break;
}
}
}
get_header();
$page_top = get_post_meta($post->ID, 'truelysell_page_top', TRUE);
switch ($page_top) {
case 'titlebar':
get_template_part('template-parts/header', 'titlebar');
break;
case 'parallax':
get_template_part('template-parts/header', 'parallax');
break;
case 'off':
break;
default:
get_template_part('template-parts/header', 'titlebar');
break;
}
$layout = get_post_meta($post->ID, 'truelysell_page_layout', true);
if (empty($layout)) {
$layout = 'right-sidebar';
}
$class = ($layout != "full-width") ? "col-lg-9 col-md-8 padding-right-30" : "col-md-12"; ?>
<div class="content">
<div class="container <?php echo esc_attr($layout); ?>">
<div class="login-wrap">
<?php if ($not_verified) : ?>
<div class="alert alert-danger">
<?php esc_html_e('Your account was not yet activated. We will keep you posted', 'truelysell'); ?>
</div>
<?php endif; ?>
<?php if (count($errors) > 0) : ?>
<?php foreach ($errors as $error) : ?>
<div class="notification error closeable">
<div class="alert alert-danger"><?php echo esc_html($error); ?>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php if (isset($_REQUEST['registered_verify'])) : ?>
<div class="notification success closeable">
<div class="badge w-100 text-bg-success closeable">
<p class="mb-2 text-transform-none" >
<?php
printf(
esc_html__('You have successfully registered.', 'truelysell'),
);
?>
</p>
<p class="text-transform-none" >
<?php
printf(
esc_html__('You can login once admin approval.', 'truelysell'),
);
?>
</p>
</div>
</div>
<?php endif; ?>
<?php if (isset($_REQUEST['registered'])) : ?>
<div class="notification success closeable">
<div class="badge text-bg-success closeable"><p>
<?php
printf(
esc_html__('You have successfully registered to %s.', 'truelysell'),
'<strong>' . get_bloginfo('name') . '</strong>'
);
?>
</p></div>
</div>
<?php endif; ?>
<!-- Login Form -->
<?php
$redirect_to = isset($_GET['redirect_to']) ? esc_url($_GET['redirect_to']) : home_url();
/*WPEngine compatibility*/
if (defined('PWP_NAME')) { ?>
<form method="post" id="login" class="login needs-validationlogin" action="<?php echo wp_login_url($redirect_to).'?wpe-login=';echo PWP_NAME;?>" >
<?php } else { ?>
<form method="post" id="login" class="login needs-validationlogin" action="<?php echo wp_login_url($redirect_to); ?>">
<?php } ?>
<?php do_action( 'truelysell_before_login_form' ); ?>
<div class="form-group">
<label class="col-form-label"><?php esc_html_e('Email','truelysell'); ?></label>
<input type="text" class="input-text form-control" name="log" id="user_login" value="" required ="" placeholder="[email protected]"/>
<div id="" class="invalid-feedback"><?php esc_html_e('Email is required.','truelysell'); ?></div>
</div>
<div class="form-group">
<label class="col-form-label"><?php esc_html_e('Password','truelysell'); ?></label>
<div class="pass-group">
<input class="input-text form-control pass-input" type="password" name="pwd" id="user_pass" required placeholder="*************"/>
<span class="toggle-password feather-eye"></span>
<div id="" class="invalid-feedback"><?php esc_html_e('Password is required.','truelysell'); ?></div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="char-length">
<p><?php esc_html_e('Must be 6 Characters at Least','truelysell'); ?></p>
</div>
</div>
<div class="col-md-6">
<div class="text-md-end">
<a class="forgot-link" href="<?php echo esc_url(get_permalink(truelysell_fl_framework_getoptions('lost_password_page'))); ?>"><?php esc_html_e( 'Forgot password?', 'truelysell' ); ?></a>
</div>
</div>
</div>
<?php wp_nonce_field( 'truelysell-ajax-login-nonce', 'login_security' ); ?>
<input type="submit" class="btn btn-primary w-100 login-btn mb-0" id="loginbtn" name="login" value="<?php echo esc_attr('Sign in','truelysell') ?>" />
<p class="no-acc "><?php esc_html_e("Don't have an account ?",'truelysell'); ?> <a href="<?php echo esc_url(get_permalink(truelysell_fl_framework_getoptions('register_page'))); ?>"><?php esc_html_e('Register','truelysell'); ?></a></p>
</form>
<!-- /Login Form -->
<style>
.login-info {
margin-top: 20px;
background: #fff;
}
.login-wrap .info-box .badge {
margin: 0;
}
.info-box {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px;
border: 1px solid #F7F7FF;
margin-bottom: 10px;
text-align: left;
background: #F7F7FF;
border-radius: 10px;
}
.info-box p{
text-align: left;
font-weight: bold;
margin-bottom: 0;
}
.info-box span {
font-weight: normal;
}
</style>
<div class="login-or">
<span class="or-line"></span>
<h5 class="span-or">Demo Login </h5>
</div>
<div class="login-info">
<div class="info-box">
<span class="btn btn-dark btn-sm">Provider</span>
<div>
<p>Username: <span id="provider-email">providerdemo</span></p>
<p>Password: <span id="provider-password">123456</span></p>
</div>
<button class="fill-btn btn btn-primary btn-sm" onclick="fillLogin('providerdemo', '123456')"><i class="fa fa-copy"></i></button>
</div>
<div class="info-box">
<span class="btn btn-dark btn-sm ">Customer</span>
<div>
<p>Username: <span id="user-email">customerdemo</span></p>
<p>Password: <span id="user-password">123456</span></p>
</div>
<button class="fill-btn btn btn-primary btn-sm" onclick="fillLogin('customerdemo', '123456')"><i class="fa fa-copy"></i></button>
</div>
</div>
<script>
// Function to fill email and password fields
function fillLogin(email, password) {
document.getElementById('user_login').value = email;
document.getElementById('user_pass').value = password;
}
</script>
</div>
<?php if(function_exists('_wsl_e')) { ?>
<div class="social-login-separator"><span><?php esc_html_e('Sign In with Social Network','truelysell'); ?></span></div>
<?php do_action( 'wordpress_social_login' ); ?>
<?php } ?>
<?php
if(function_exists('mo_openid_initialize_social_login')) { ?>
<div class="social-miniorange-container">
<div class="social-login-separator"><span><?php esc_html_e('Sign In with Social Network','truelysell'); ?></span></div><?php echo do_shortcode( '[miniorange_social_login view="horizontal" heading=""]' );
?>
</div>
<?php } ?>
<?php
if(class_exists('NextendSocialLogin', false)){
echo NextendSocialLogin::renderButtonsWithContainer();
}
?>
</div>
</div>
<div class="clearfix"></div>
<?php
get_footer();
} ?>