| 1 |
<?php |
| 2 |
/** |
| 3 |
* Booking Authentication Partial |
| 4 |
* Shows login/registration forms when user is not logged in |
| 5 |
* |
| 6 |
* @package Yatra |
| 7 |
*/ |
| 8 |
|
| 9 |
// Prevent direct access |
| 10 |
if (!defined('ABSPATH')) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
global $booking; |
| 15 |
$trip = $booking->trip ?? null; |
| 16 |
?> |
| 17 |
|
| 18 |
<div class="yatra-booking-auth"> |
| 19 |
<!-- Tab Navigation --> |
| 20 |
<div class="yatra-auth-tabs"> |
| 21 |
<button type="button" class="yatra-auth-tab active" data-tab="login"> |
| 22 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 23 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 16l-4-4m0 0l4-4m-4 4h14m-5 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h7a3 3 0 013 3v1"/> |
| 24 |
</svg> |
| 25 |
<?php esc_html_e('Login', 'yatra'); ?> |
| 26 |
</button> |
| 27 |
<button type="button" class="yatra-auth-tab" data-tab="register"> |
| 28 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 29 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"/> |
| 30 |
</svg> |
| 31 |
<?php esc_html_e('Register', 'yatra'); ?> |
| 32 |
</button> |
| 33 |
</div> |
| 34 |
|
| 35 |
<!-- Login Form --> |
| 36 |
<div class="yatra-auth-content" id="yatra-auth-login"> |
| 37 |
<div class="yatra-auth-header"> |
| 38 |
<h2><?php esc_html_e('Welcome Back', 'yatra'); ?></h2> |
| 39 |
<p><?php esc_html_e('Please login to continue with your booking.', 'yatra'); ?></p> |
| 40 |
</div> |
| 41 |
|
| 42 |
<?php if (isset($_GET['email_verified']) && $_GET['email_verified'] === '1') : ?> |
| 43 |
<div class="yatra-auth-message success" style="display: block; margin-bottom: 20px;"> |
| 44 |
<?php esc_html_e('Your email has been verified successfully! You can now log in.', 'yatra'); ?> |
| 45 |
</div> |
| 46 |
<?php endif; ?> |
| 47 |
|
| 48 |
<form id="yatra-login-form" class="yatra-auth-form" method="post"> |
| 49 |
|
| 50 |
<div class="yatra-form-group"> |
| 51 |
<label for="yatra-login-email"> |
| 52 |
<?php esc_html_e('Email or Username', 'yatra'); ?> |
| 53 |
<span class="required">*</span> |
| 54 |
</label> |
| 55 |
<div class="yatra-input-wrapper"> |
| 56 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 57 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/> |
| 58 |
</svg> |
| 59 |
<input type="text" id="yatra-login-email" name="log" required placeholder="<?php esc_attr_e('Enter your email or username', 'yatra'); ?>"> |
| 60 |
</div> |
| 61 |
</div> |
| 62 |
|
| 63 |
<div class="yatra-form-group"> |
| 64 |
<label for="yatra-login-password"> |
| 65 |
<?php esc_html_e('Password', 'yatra'); ?> |
| 66 |
<span class="required">*</span> |
| 67 |
</label> |
| 68 |
<div class="yatra-input-wrapper"> |
| 69 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 70 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/> |
| 71 |
</svg> |
| 72 |
<input type="password" id="yatra-login-password" name="pwd" required placeholder="<?php esc_attr_e('Enter your password', 'yatra'); ?>"> |
| 73 |
<button type="button" class="yatra-toggle-password" tabindex="-1"> |
| 74 |
<svg class="eye-open" width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 75 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/> |
| 76 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/> |
| 77 |
</svg> |
| 78 |
<svg class="eye-closed" width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="display:none;"> |
| 79 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"/> |
| 80 |
</svg> |
| 81 |
</button> |
| 82 |
</div> |
| 83 |
</div> |
| 84 |
|
| 85 |
<div class="yatra-form-options"> |
| 86 |
<label class="yatra-checkbox-label"> |
| 87 |
<input type="checkbox" name="rememberme" value="forever"> |
| 88 |
<span><?php esc_html_e('Remember me', 'yatra'); ?></span> |
| 89 |
</label> |
| 90 |
<a href="<?php echo esc_url(wp_lostpassword_url()); ?>" class="yatra-forgot-link"> |
| 91 |
<?php esc_html_e('Forgot password?', 'yatra'); ?> |
| 92 |
</a> |
| 93 |
</div> |
| 94 |
|
| 95 |
<div class="yatra-auth-message" id="yatra-login-message" style="display:none;"></div> |
| 96 |
|
| 97 |
<button type="submit" class="yatra-auth-submit"> |
| 98 |
<span class="btn-text"><?php esc_html_e('Login & Continue', 'yatra'); ?></span> |
| 99 |
<span class="btn-loading" style="display:none;"> |
| 100 |
<svg class="animate-spin" width="18" height="18" fill="none" viewBox="0 0 24 24"> |
| 101 |
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> |
| 102 |
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> |
| 103 |
</svg> |
| 104 |
<?php esc_html_e('Logging in...', 'yatra'); ?> |
| 105 |
</span> |
| 106 |
</button> |
| 107 |
</form> |
| 108 |
|
| 109 |
<div class="yatra-auth-footer"> |
| 110 |
<p><?php esc_html_e("Don't have an account?", 'yatra'); ?> |
| 111 |
<button type="button" class="yatra-switch-tab" data-tab="register"><?php esc_html_e('Register now', 'yatra'); ?></button> |
| 112 |
</p> |
| 113 |
</div> |
| 114 |
</div> |
| 115 |
|
| 116 |
<!-- Registration Form --> |
| 117 |
<div class="yatra-auth-content" id="yatra-auth-register" style="display:none;"> |
| 118 |
<div class="yatra-auth-header"> |
| 119 |
<h2><?php esc_html_e('Create Account', 'yatra'); ?></h2> |
| 120 |
<p><?php esc_html_e('Register to book your trip and manage your bookings.', 'yatra'); ?></p> |
| 121 |
</div> |
| 122 |
|
| 123 |
<form id="yatra-register-form" class="yatra-auth-form" method="post"> |
| 124 |
|
| 125 |
<div class="yatra-form-row"> |
| 126 |
<div class="yatra-form-group"> |
| 127 |
<label for="yatra-reg-first-name"> |
| 128 |
<?php esc_html_e('First Name', 'yatra'); ?> |
| 129 |
<span class="required">*</span> |
| 130 |
</label> |
| 131 |
<input type="text" id="yatra-reg-first-name" name="first_name" required placeholder="<?php esc_attr_e('John', 'yatra'); ?>"> |
| 132 |
</div> |
| 133 |
<div class="yatra-form-group"> |
| 134 |
<label for="yatra-reg-last-name"> |
| 135 |
<?php esc_html_e('Last Name', 'yatra'); ?> |
| 136 |
<span class="required">*</span> |
| 137 |
</label> |
| 138 |
<input type="text" id="yatra-reg-last-name" name="last_name" required placeholder="<?php esc_attr_e('Doe', 'yatra'); ?>"> |
| 139 |
</div> |
| 140 |
</div> |
| 141 |
|
| 142 |
<div class="yatra-form-group"> |
| 143 |
<label for="yatra-reg-email"> |
| 144 |
<?php esc_html_e('Email Address', 'yatra'); ?> |
| 145 |
<span class="required">*</span> |
| 146 |
</label> |
| 147 |
<div class="yatra-input-wrapper"> |
| 148 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 149 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/> |
| 150 |
</svg> |
| 151 |
<input type="email" id="yatra-reg-email" name="email" required placeholder="<?php esc_attr_e('[email protected]', 'yatra'); ?>"> |
| 152 |
</div> |
| 153 |
</div> |
| 154 |
|
| 155 |
<div class="yatra-form-group"> |
| 156 |
<label for="yatra-reg-phone"> |
| 157 |
<?php esc_html_e('Phone Number', 'yatra'); ?> |
| 158 |
</label> |
| 159 |
<div class="yatra-input-wrapper"> |
| 160 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 161 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"/> |
| 162 |
</svg> |
| 163 |
<input type="tel" id="yatra-reg-phone" name="phone" placeholder="<?php esc_attr_e('+1 234 567 8900', 'yatra'); ?>"> |
| 164 |
</div> |
| 165 |
</div> |
| 166 |
|
| 167 |
<div class="yatra-form-group"> |
| 168 |
<label for="yatra-reg-password"> |
| 169 |
<?php esc_html_e('Password', 'yatra'); ?> |
| 170 |
<span class="required">*</span> |
| 171 |
</label> |
| 172 |
<div class="yatra-input-wrapper"> |
| 173 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 174 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/> |
| 175 |
</svg> |
| 176 |
<input type="password" id="yatra-reg-password" name="password" required minlength="8" placeholder="<?php esc_attr_e('Minimum 8 characters', 'yatra'); ?>"> |
| 177 |
<button type="button" class="yatra-toggle-password" tabindex="-1"> |
| 178 |
<svg class="eye-open" width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 179 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/> |
| 180 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/> |
| 181 |
</svg> |
| 182 |
<svg class="eye-closed" width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24" style="display:none;"> |
| 183 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21"/> |
| 184 |
</svg> |
| 185 |
</button> |
| 186 |
</div> |
| 187 |
<div class="yatra-password-strength" id="yatra-password-strength"></div> |
| 188 |
</div> |
| 189 |
|
| 190 |
<div class="yatra-form-group"> |
| 191 |
<label for="yatra-reg-confirm-password"> |
| 192 |
<?php esc_html_e('Confirm Password', 'yatra'); ?> |
| 193 |
<span class="required">*</span> |
| 194 |
</label> |
| 195 |
<div class="yatra-input-wrapper"> |
| 196 |
<svg width="18" height="18" fill="none" stroke="currentColor" viewBox="0 0 24 24"> |
| 197 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/> |
| 198 |
</svg> |
| 199 |
<input type="password" id="yatra-reg-confirm-password" name="confirm_password" required placeholder="<?php esc_attr_e('Re-enter your password', 'yatra'); ?>"> |
| 200 |
</div> |
| 201 |
</div> |
| 202 |
|
| 203 |
<div class="yatra-form-group"> |
| 204 |
<label class="yatra-checkbox-label"> |
| 205 |
<input type="checkbox" name="terms" required> |
| 206 |
<span> |
| 207 |
<?php |
| 208 |
printf( |
| 209 |
/* translators: %1$s: terms link, %2$s: privacy link */ |
| 210 |
esc_html__('I agree to the %1$s and %2$s', 'yatra'), |
| 211 |
'<a href="' . esc_url(get_privacy_policy_url()) . '" target="_blank">' . esc_html__('Terms of Service', 'yatra') . '</a>', |
| 212 |
'<a href="' . esc_url(get_privacy_policy_url()) . '" target="_blank">' . esc_html__('Privacy Policy', 'yatra') . '</a>' |
| 213 |
); |
| 214 |
?> |
| 215 |
</span> |
| 216 |
</label> |
| 217 |
</div> |
| 218 |
|
| 219 |
<div class="yatra-auth-message" id="yatra-register-message" style="display:none;"></div> |
| 220 |
|
| 221 |
<button type="submit" class="yatra-auth-submit"> |
| 222 |
<span class="btn-text"><?php esc_html_e('Create Account & Continue', 'yatra'); ?></span> |
| 223 |
<span class="btn-loading" style="display:none;"> |
| 224 |
<svg class="animate-spin" width="18" height="18" fill="none" viewBox="0 0 24 24"> |
| 225 |
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle> |
| 226 |
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path> |
| 227 |
</svg> |
| 228 |
<?php esc_html_e('Creating account...', 'yatra'); ?> |
| 229 |
</span> |
| 230 |
</button> |
| 231 |
</form> |
| 232 |
|
| 233 |
<div class="yatra-auth-footer"> |
| 234 |
<p><?php esc_html_e('Already have an account?', 'yatra'); ?> |
| 235 |
<button type="button" class="yatra-switch-tab" data-tab="login"><?php esc_html_e('Login here', 'yatra'); ?></button> |
| 236 |
</p> |
| 237 |
</div> |
| 238 |
</div> |
| 239 |
</div> |
| 240 |
|