| 1 |
<?php |
| 2 |
/** |
| 3 |
* WCPOS Auth template: posts to JWT endpoint and redirects. |
| 4 |
* |
| 5 |
* This template can be overridden by copying it to yourtheme/woocommerce-pos/auth.php. |
| 6 |
* HOWEVER, this is not recommended , don't be surprised if your POS breaks |
| 7 |
*/ |
| 8 |
|
| 9 |
\defined( 'ABSPATH' ) || exit; |
| 10 |
|
| 11 |
// Get Auth instance from global scope (set by Templates class) |
| 12 |
global $wcpos_auth_instance; |
| 13 |
|
| 14 |
// Fallback if no instance is available |
| 15 |
if ( ! $wcpos_auth_instance ) { |
| 16 |
$wcpos_auth_instance = new WCPOS\WooCommercePOS\Templates\Auth(); |
| 17 |
} |
| 18 |
|
| 19 |
$redirect_uri = $wcpos_auth_instance->get_redirect_uri(); |
| 20 |
$error = $wcpos_auth_instance->get_error(); |
| 21 |
?><!DOCTYPE html> |
| 22 |
<html <?php language_attributes(); ?>> |
| 23 |
<head> |
| 24 |
<title><?php _e('WooCommerce POS Login'); ?></title> |
| 25 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 26 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 27 |
<link rel='stylesheet' id='dashicons-css' href='<?php echo includes_url( 'css/dashicons.min.css' ); ?>?ver=<?php echo get_bloginfo( 'version' ); ?>' media='all' /> |
| 28 |
<link rel='stylesheet' id='buttons-css' href='<?php echo includes_url( 'css/buttons.min.css' ); ?>?ver=<?php echo get_bloginfo( 'version' ); ?>' media='all' /> |
| 29 |
<link rel='stylesheet' id='forms-css' href='<?php echo admin_url( 'css/forms.min.css' ); ?>?ver=<?php echo get_bloginfo( 'version' ); ?>' media='all' /> |
| 30 |
<link rel='stylesheet' id='l10n-css' href='<?php echo admin_url( 'css/l10n.min.css' ); ?>?ver=<?php echo get_bloginfo( 'version' ); ?>' media='all' /> |
| 31 |
<link rel='stylesheet' id='login-css' href='<?php echo admin_url( 'css/login.min.css' ); ?>?ver=<?php echo get_bloginfo( 'version' ); ?>' media='all' /> |
| 32 |
</head> |
| 33 |
<body class="login no-js login-action-login wp-core-ui locale-<?php echo str_replace('_', '-', get_locale()); ?>"> |
| 34 |
<script type="text/javascript"> |
| 35 |
document.body.className = document.body.className.replace('no-js','js'); |
| 36 |
</script> |
| 37 |
<div id="login"> |
| 38 |
<div style="text-align: center;"> |
| 39 |
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" tabindex="-1"> |
| 40 |
<img src="<?php echo esc_attr( WCPOS\WooCommercePOS\PLUGIN_URL ); ?>assets/img/wcpos-icon.svg" alt="WooCommerce POS" style="width: 100px; height: 100px;"/> |
| 41 |
</a> |
| 42 |
</div> |
| 43 |
|
| 44 |
<form name="wcpos-loginform" id="wcpos-loginform" action="" method="post"> |
| 45 |
<?php if ( $error ) { ?> |
| 46 |
<div id="login_error" style="color: #CD2C24; padding-bottom: 10px;"><?php echo wp_kses( $error, array( 'strong' => array(), 'em' => array(), 'a' => array( 'href' => array() ) ) ); ?></div> |
| 47 |
<?php } ?> |
| 48 |
|
| 49 |
<p> |
| 50 |
<label for="wcpos-user-login"><?php _e('Username or Email Address'); ?></label> |
| 51 |
<input type="text" name="wcpos-log" id="wcpos-user-login" class="input" value="" size="20" autocapitalize="off" autocomplete="username" required="required" /> |
| 52 |
</p> |
| 53 |
|
| 54 |
<div class="user-pass-wrap"> |
| 55 |
<label for="wcpos-user-pass"><?php _e('Password'); ?></label> |
| 56 |
<div class="wp-pwd"> |
| 57 |
<input type="password" name="wcpos-pwd" id="wcpos-user-pass" class="input password-input" value="" size="20" autocomplete="current-password" spellcheck="false" required="required" /> |
| 58 |
<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Show password'); ?>"> |
| 59 |
<span class="dashicons dashicons-visibility" aria-hidden="true"></span> |
| 60 |
</button> |
| 61 |
</div> |
| 62 |
</div> |
| 63 |
|
| 64 |
<?php wp_nonce_field( 'wcpos_auth', '_wpnonce' ); ?> |
| 65 |
|
| 66 |
<!-- Auth session token for expiring auth URLs --> |
| 67 |
<input type="hidden" name="auth_session" value="<?php echo esc_attr( $wcpos_auth_instance->get_auth_session() ); ?>" /> |
| 68 |
|
| 69 |
<!-- Honeypot field - should remain empty, hidden from users via CSS --> |
| 70 |
<div style="position: absolute; left: -9999px;" aria-hidden="true"> |
| 71 |
<label for="wcpos-website">Website</label> |
| 72 |
<input type="text" name="wcpos_website" id="wcpos-website" value="" tabindex="-1" autocomplete="off" /> |
| 73 |
</div> |
| 74 |
|
| 75 |
<p class="submit"> |
| 76 |
<input type="submit" name="wcpos-submit" id="wcpos-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>"> |
| 77 |
</p> |
| 78 |
</form> |
| 79 |
|
| 80 |
</div> |
| 81 |
|
| 82 |
<div class="clear"></div> |
| 83 |
|
| 84 |
<script type="text/javascript"> |
| 85 |
(function() { |
| 86 |
// Check if we're on demo domains and auto-populate credentials |
| 87 |
var hostname = window.location.hostname; |
| 88 |
var isDemoDomain = hostname === 'demo.wcpos.com' || hostname === 'wcposdev.wpengine.com'; |
| 89 |
|
| 90 |
if (isDemoDomain) { |
| 91 |
// Wait for DOM to be ready |
| 92 |
document.addEventListener('DOMContentLoaded', function() { |
| 93 |
var usernameField = document.getElementById('wcpos-user-login'); |
| 94 |
var passwordField = document.getElementById('wcpos-user-pass'); |
| 95 |
|
| 96 |
if (usernameField && passwordField) { |
| 97 |
usernameField.value = 'demo'; |
| 98 |
passwordField.value = 'demo'; |
| 99 |
} |
| 100 |
}); |
| 101 |
} |
| 102 |
})(); |
| 103 |
</script> |
| 104 |
</body> |
| 105 |
</html> |