if($favicon) {?> } ?> echo $this->Html->script('/js/components/jquery-3.3.1.min'); echo $this->Html->script('/js/components/jquery.validate.min.js'); echo $this->Html->script('/js/components/bootstrap-4.1.0.min'); // Bootstrap echo $this->Html->css('/css/bootstrap.min'); echo $this->Html->css(get_static_hash_file('/build/css/app', 'css')); echo $this->fetch('meta'); echo $this->fetch('css'); echo $this->fetch('script'); ?>
$coverImage = 'https://bookinglayer.s3.amazonaws.com/login/' . $cover['image'];?><div class="bg-cover vh-100 mt--1 mr--3" style="overflow:none;background-image: url(<?= $coverImage ?>);">
$viewFile = '/home/devel/devel-app.bookinglayer.io/releases/000000/View/Layouts/login.ctp'
$dataForView = array(
'section' => 'settings',
'covers' => array(
(int) 0 => array(
'author' => null,
'image' => 'surfing.jpg'
),
(int) 1 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@simonmigaj">Simon Migaj</a>',
'image' => 'meditation.jpg'
),
(int) 2 => array(
'author' => '<a target="_blank" href="https://www.instagram.com/oldo.nicho">Oliver Nicholson</a>',
'image' => 'bay.jpg'
),
(int) 3 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@simonfitall">Simon Fitall</a>',
'image' => 'mountains.jpg'
),
(int) 4 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@emmapaillex">Emma Paillex</a>',
'image' => 'longboarding.jpg'
),
(int) 5 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@draufsicht">Andreas Gücklhorn</a>',
'image' => 'birdseye.jpg'
),
(int) 6 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@vorosbenisop">Benjamin Voris</a>',
'image' => 'stars.jpg'
),
(int) 7 => array(
'author' => '<a target="_blank" href="http://instagram.com/explorewithjoshua">Joshua Earle</a>',
'image' => 'lake.jpg'
),
(int) 8 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@neonbrandr">NeONBRAND</a>',
'image' => 'canyon.jpg'
)
),
'content_for_layout' => '<div>
<img class="login-logo" src="/img/logo_login_black.png"/>
</div>
<form action="/login" id="login-form" method="post" accept-charset="utf-8">
<div id="step-login" class="login-step">
<p class="text-muted text-center mb-5">
Access your Backoffice
</p>
<div class="form-group">
<label>Email</label>
<input id="email" name="email" value="" type="text" class="form-control ">
<span class="help-block"></span>
</div>
<div class="form-group">
<label>Password</label>
<input name="password" type="password" id="password" autocomplete="off" class="form-control " value="">
<span class="help-block"></span>
</div>
<div class="mb-3">
<a href="/password/forgot" class="text-black"><small>Forgot your password?</small></a>
</div>
<div class="errors"></div>
<div class="mt-3">
<button type="submit" class="login-button btn btn-secondary btn-lg btn-block">Login</button>
</div>
</div>
<div id="step-2fa-choice" class="login-step" style="display:none">
<p class="text-muted text-center mb-5">
Choose your preferred verification method
</p>
<div class="d-flex flex-column justify-content-center align-items-center">
<div class="2fa-method card-option" data-method="authenticator" onclick="BookinglayerLogin.showTwoFactorAuthenticator()">
<div class="icon-circle">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-phone" viewBox="0 0 16 16">
<path d="M11 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>
<path d="M8 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2"/>
</svg>
</div>
<div class="option-text">
<h5>Authenticator App</h5>
<p>Use your authenticator app to generate a verification code</p>
</div>
</div>
<div class="2fa-method card-option" data-method="email" onclick="BookinglayerLogin.showTwoFactorEmail()">
<div class="icon-circle email">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope" viewBox="0 0 16 16">
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"/>
</svg>
</div>
<div class="option-text">
<h5>Email Code</h5>
<p>We'll send a verification code to your email address</p>
</div>
</div>
</div>
</div>
<div id="step-2fa-authenticator" class="login-step" style="display:none">
<p class="text-muted text-center mb-5">Enter the 6-digit code<br /> found in your authenticator app</p>
<div class="form-group">
<label>Authenticator code</label>
<input id="2fa_otp" name="2fa_otp" value="" type="text" class="form-control " autocomplete="off" maxlength="6">
<span class="help-block"></span>
</div>
<div class="mb-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" name="trust_device_authenticator" id="trust-device-authenticator">
<label class="custom-control-label" for="trust-device-authenticator">Trust this device for 90 days</label>
</div>
</div>
<div class="errors"></div>
<div class="mt-3">
<button type="submit" class="login-button btn btn-secondary btn-lg btn-block">Verify</button>
</div>
</div>
<div id="step-2fa-email" class="login-step" style="display:none">
<p class="text-muted text-center mb-5">Enter the 6-digit code<br/> found in your email</p>
<div class="form-group">
<label>Verification code</label>
<input id="2fa_code" name="2fa_code" value="" type="text" class="form-control " autocomplete="off" maxlength="6">
<span class="help-block"></span>
</div>
<div class="mb-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" name="trust_device_email" id="trust-device-email">
<label class="custom-control-label" for="trust-device-email">Trust this device for 90 days</label>
</div>
</div>
<div class="errors"></div>
<div class="mt-3">
<button type="submit" class="login-button btn btn-secondary btn-lg btn-block">Verify</button>
</div>
</div>
</form>
<script>
$( "#login-form" ).on( "submit", function( event ) {
$('.login-button').prop('disabled', true);
BookinglayerLogin.login();
event.preventDefault();
});
var BookinglayerLogin = {
apiBaseUrl: 'https://devel-api.bookinglayer.io/',
showTwoFactorAuthenticator: function(step) {
$('#step-2fa-choice').hide();
$('#step-2fa-authenticator').show();
},
showTwoFactorEmail: function(step) {
$('#step-2fa-choice').hide();
$('#step-2fa-email').show();
BookinglayerLogin.sendTwoFactorVerificationCodeByEmail();
},
showTwoFactorChoice: function(availableMethods) {
$('#step-login').hide();
// No need to show options
if(availableMethods.length == 1 && availableMethods.includes('authenticator')) {
BookinglayerLogin.showTwoFactorAuthenticator();
return false;
}
if(availableMethods.length == 1 && availableMethods.includes('email')) {
BookinglayerLogin.showTwoFactorEmail();
return false;
}
$('.2fa-method').hide();
if(availableMethods.includes('authenticator')) {
$('.2fa-method[data-method="authenticator"]').show();
}
if(availableMethods.includes('email')) {
$('.2fa-method[data-method="email"]').show();
}
$('#step-2fa-choice').show();
},
sendTwoFactorVerificationCodeByEmail: function() {
$.ajax({
url: BookinglayerLogin.apiBaseUrl + 'private/auth/login/email_2fa_code/send',
type: "POST",
dataType: "json",
data: {
email: $('#email').val(),
password: $('#password').val()
},
success: function(response) {
}
});
},
login: function() {
if(!BookinglayerLogin.validate()) {
$('.login-button').prop('disabled', false);
return false;
}
data = {
email: $('#email').val(),
password: $('#password').val(),
};
if($('#step-2fa-authenticator').is(':visible')) {
data['2fa_otp'] = $('#2fa_otp').val();
data['trust_device'] = $('#trust-device-authenticator').is(':checked') ? 1 : 0;
}
if($('#step-2fa-email').is(':visible')) {
data['2fa_code'] = $('#2fa_code').val();
data['trust_device'] = $('#trust-device-email').is(':checked') ? 1 : 0;
}
$.ajax({
url: '/users/ajax_login.json',
type: "POST",
dataType: "json",
data: data,
error: function(response) {
BookinglayerLogin.renderError('Technical issue. Please try again later.');
$('.login-button').prop('disabled', false);
},
success: function(response) {
if(response.error && response.error.code == 'account_not_active') {
location.href = response.error.redirect;
return false;
}
if(response.error && response.error.code == 'invalid_credentials') {
BookinglayerLogin.renderError('Incorrect email or password');
$('.login-button').prop('disabled', false);
return false;
}
if(response.error && response.error.code == 'two_factor_authentication_invalid_code') {
BookinglayerLogin.renderError('Incorrect verification code');
$('.login-button').prop('disabled', false);
return false;
}
if(response.error && response.error.code == 'invalid_device_token') {
BookinglayerLogin.showTwoFactorChoice(response.error['2fa_available_methods']);
$('.login-button').prop('disabled', false);
return false;
}
if(response.error && response.error.code == 'missing_two_factor_authentication_code') {
BookinglayerLogin.showTwoFactorChoice(response.error['2fa_available_methods']);
$('.login-button').prop('disabled', false);
return false;
}
if(response.errors && response.errors[0] && response.errors[0].type == 'http_exception') {
BookinglayerLogin.renderError(response.errors[0].message);
$('.login-button').prop('disabled', false);
return false;
}
BookinglayerLogin.postLogin(response.data.access_token);
},
});
},
postLogin: function(token) {
BookinglayerLogin.showLoader();
$.ajax({
url: '/users/post_login.json',
type: "POST",
dataType: "json",
data: {
access_token: token
},
success: function(response) {
location.href = response.redirect_url;
},
error: function(response) {
BookinglayerLogin.renderError('Cannot login. Please contact support.');
},
});
},
showLoader: function() {
$('.login-button').text('Logging in...please wait...');
},
renderError: function(errorMessage) {
$('.errors').html(`<p class="text-danger">${errorMessage}</p>`);
},
validate: function() {
if( $('#step-2fa-authenticator').is(':visible') && $('#2fa_otp').val().length != 6 ) {
BookinglayerLogin.showValidationFieldError($('#2fa_otp'),'A 6 digit code is expected');
return false;
}
if( $('#step-2fa-email').is(':visible') && $('#2fa_code').val().length != 6 ) {
BookinglayerLogin.showValidationFieldError($('#2fa_code'),'A 6 digit code is expected');
return false;
}
if( $('#step-login').is(':visible') && !$('#email').val()) {
BookinglayerLogin.showValidationFieldError($('#email'),'Email missing');
return false;
}
if( $('#step-login').is(':visible') && !$('#password').val()) {
BookinglayerLogin.showValidationFieldError($('#password'),'Password missing');
return false;
}
if( $('#step-login').is(':visible') && !BookinglayerLogin.isValidEmailAddress($('#email').val())) {
BookinglayerLogin.showValidationFieldError($('#email'),'This email seems to be invalid.');
return false;
}
return true;
},
isValidEmailAddress: function(emailAddress) {
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
return pattern.test(emailAddress);
},
showValidationFieldError($field,message) {
$field.parents('.form-group:first').addClass('has-error').find('.help-block').text(message);
}
}
$(document).ready(function() {
$('#email').focus();
});
</script>
',
'scripts_for_layout' => '',
'title_for_layout' => 'Users'
)
$section = 'settings'
$covers = array(
(int) 0 => array(
'author' => null,
'image' => 'surfing.jpg'
),
(int) 1 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@simonmigaj">Simon Migaj</a>',
'image' => 'meditation.jpg'
),
(int) 2 => array(
'author' => '<a target="_blank" href="https://www.instagram.com/oldo.nicho">Oliver Nicholson</a>',
'image' => 'bay.jpg'
),
(int) 3 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@simonfitall">Simon Fitall</a>',
'image' => 'mountains.jpg'
),
(int) 4 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@emmapaillex">Emma Paillex</a>',
'image' => 'longboarding.jpg'
),
(int) 5 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@draufsicht">Andreas Gücklhorn</a>',
'image' => 'birdseye.jpg'
),
(int) 6 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@vorosbenisop">Benjamin Voris</a>',
'image' => 'stars.jpg'
),
(int) 7 => array(
'author' => '<a target="_blank" href="http://instagram.com/explorewithjoshua">Joshua Earle</a>',
'image' => 'lake.jpg'
),
(int) 8 => array(
'author' => '<a target="_blank" href="https://unsplash.com/@neonbrandr">NeONBRAND</a>',
'image' => 'canyon.jpg'
)
)
$content_for_layout = '<div>
<img class="login-logo" src="/img/logo_login_black.png"/>
</div>
<form action="/login" id="login-form" method="post" accept-charset="utf-8">
<div id="step-login" class="login-step">
<p class="text-muted text-center mb-5">
Access your Backoffice
</p>
<div class="form-group">
<label>Email</label>
<input id="email" name="email" value="" type="text" class="form-control ">
<span class="help-block"></span>
</div>
<div class="form-group">
<label>Password</label>
<input name="password" type="password" id="password" autocomplete="off" class="form-control " value="">
<span class="help-block"></span>
</div>
<div class="mb-3">
<a href="/password/forgot" class="text-black"><small>Forgot your password?</small></a>
</div>
<div class="errors"></div>
<div class="mt-3">
<button type="submit" class="login-button btn btn-secondary btn-lg btn-block">Login</button>
</div>
</div>
<div id="step-2fa-choice" class="login-step" style="display:none">
<p class="text-muted text-center mb-5">
Choose your preferred verification method
</p>
<div class="d-flex flex-column justify-content-center align-items-center">
<div class="2fa-method card-option" data-method="authenticator" onclick="BookinglayerLogin.showTwoFactorAuthenticator()">
<div class="icon-circle">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-phone" viewBox="0 0 16 16">
<path d="M11 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM5 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>
<path d="M8 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2"/>
</svg>
</div>
<div class="option-text">
<h5>Authenticator App</h5>
<p>Use your authenticator app to generate a verification code</p>
</div>
</div>
<div class="2fa-method card-option" data-method="email" onclick="BookinglayerLogin.showTwoFactorEmail()">
<div class="icon-circle email">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope" viewBox="0 0 16 16">
<path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"/>
</svg>
</div>
<div class="option-text">
<h5>Email Code</h5>
<p>We'll send a verification code to your email address</p>
</div>
</div>
</div>
</div>
<div id="step-2fa-authenticator" class="login-step" style="display:none">
<p class="text-muted text-center mb-5">Enter the 6-digit code<br /> found in your authenticator app</p>
<div class="form-group">
<label>Authenticator code</label>
<input id="2fa_otp" name="2fa_otp" value="" type="text" class="form-control " autocomplete="off" maxlength="6">
<span class="help-block"></span>
</div>
<div class="mb-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" name="trust_device_authenticator" id="trust-device-authenticator">
<label class="custom-control-label" for="trust-device-authenticator">Trust this device for 90 days</label>
</div>
</div>
<div class="errors"></div>
<div class="mt-3">
<button type="submit" class="login-button btn btn-secondary btn-lg btn-block">Verify</button>
</div>
</div>
<div id="step-2fa-email" class="login-step" style="display:none">
<p class="text-muted text-center mb-5">Enter the 6-digit code<br/> found in your email</p>
<div class="form-group">
<label>Verification code</label>
<input id="2fa_code" name="2fa_code" value="" type="text" class="form-control " autocomplete="off" maxlength="6">
<span class="help-block"></span>
</div>
<div class="mb-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" name="trust_device_email" id="trust-device-email">
<label class="custom-control-label" for="trust-device-email">Trust this device for 90 days</label>
</div>
</div>
<div class="errors"></div>
<div class="mt-3">
<button type="submit" class="login-button btn btn-secondary btn-lg btn-block">Verify</button>
</div>
</div>
</form>
<script>
$( "#login-form" ).on( "submit", function( event ) {
$('.login-button').prop('disabled', true);
BookinglayerLogin.login();
event.preventDefault();
});
var BookinglayerLogin = {
apiBaseUrl: 'https://devel-api.bookinglayer.io/',
showTwoFactorAuthenticator: function(step) {
$('#step-2fa-choice').hide();
$('#step-2fa-authenticator').show();
},
showTwoFactorEmail: function(step) {
$('#step-2fa-choice').hide();
$('#step-2fa-email').show();
BookinglayerLogin.sendTwoFactorVerificationCodeByEmail();
},
showTwoFactorChoice: function(availableMethods) {
$('#step-login').hide();
// No need to show options
if(availableMethods.length == 1 && availableMethods.includes('authenticator')) {
BookinglayerLogin.showTwoFactorAuthenticator();
return false;
}
if(availableMethods.length == 1 && availableMethods.includes('email')) {
BookinglayerLogin.showTwoFactorEmail();
return false;
}
$('.2fa-method').hide();
if(availableMethods.includes('authenticator')) {
$('.2fa-method[data-method="authenticator"]').show();
}
if(availableMethods.includes('email')) {
$('.2fa-method[data-method="email"]').show();
}
$('#step-2fa-choice').show();
},
sendTwoFactorVerificationCodeByEmail: function() {
$.ajax({
url: BookinglayerLogin.apiBaseUrl + 'private/auth/login/email_2fa_code/send',
type: "POST",
dataType: "json",
data: {
email: $('#email').val(),
password: $('#password').val()
},
success: function(response) {
}
});
},
login: function() {
if(!BookinglayerLogin.validate()) {
$('.login-button').prop('disabled', false);
return false;
}
data = {
email: $('#email').val(),
password: $('#password').val(),
};
if($('#step-2fa-authenticator').is(':visible')) {
data['2fa_otp'] = $('#2fa_otp').val();
data['trust_device'] = $('#trust-device-authenticator').is(':checked') ? 1 : 0;
}
if($('#step-2fa-email').is(':visible')) {
data['2fa_code'] = $('#2fa_code').val();
data['trust_device'] = $('#trust-device-email').is(':checked') ? 1 : 0;
}
$.ajax({
url: '/users/ajax_login.json',
type: "POST",
dataType: "json",
data: data,
error: function(response) {
BookinglayerLogin.renderError('Technical issue. Please try again later.');
$('.login-button').prop('disabled', false);
},
success: function(response) {
if(response.error && response.error.code == 'account_not_active') {
location.href = response.error.redirect;
return false;
}
if(response.error && response.error.code == 'invalid_credentials') {
BookinglayerLogin.renderError('Incorrect email or password');
$('.login-button').prop('disabled', false);
return false;
}
if(response.error && response.error.code == 'two_factor_authentication_invalid_code') {
BookinglayerLogin.renderError('Incorrect verification code');
$('.login-button').prop('disabled', false);
return false;
}
if(response.error && response.error.code == 'invalid_device_token') {
BookinglayerLogin.showTwoFactorChoice(response.error['2fa_available_methods']);
$('.login-button').prop('disabled', false);
return false;
}
if(response.error && response.error.code == 'missing_two_factor_authentication_code') {
BookinglayerLogin.showTwoFactorChoice(response.error['2fa_available_methods']);
$('.login-button').prop('disabled', false);
return false;
}
if(response.errors && response.errors[0] && response.errors[0].type == 'http_exception') {
BookinglayerLogin.renderError(response.errors[0].message);
$('.login-button').prop('disabled', false);
return false;
}
BookinglayerLogin.postLogin(response.data.access_token);
},
});
},
postLogin: function(token) {
BookinglayerLogin.showLoader();
$.ajax({
url: '/users/post_login.json',
type: "POST",
dataType: "json",
data: {
access_token: token
},
success: function(response) {
location.href = response.redirect_url;
},
error: function(response) {
BookinglayerLogin.renderError('Cannot login. Please contact support.');
},
});
},
showLoader: function() {
$('.login-button').text('Logging in...please wait...');
},
renderError: function(errorMessage) {
$('.errors').html(`<p class="text-danger">${errorMessage}</p>`);
},
validate: function() {
if( $('#step-2fa-authenticator').is(':visible') && $('#2fa_otp').val().length != 6 ) {
BookinglayerLogin.showValidationFieldError($('#2fa_otp'),'A 6 digit code is expected');
return false;
}
if( $('#step-2fa-email').is(':visible') && $('#2fa_code').val().length != 6 ) {
BookinglayerLogin.showValidationFieldError($('#2fa_code'),'A 6 digit code is expected');
return false;
}
if( $('#step-login').is(':visible') && !$('#email').val()) {
BookinglayerLogin.showValidationFieldError($('#email'),'Email missing');
return false;
}
if( $('#step-login').is(':visible') && !$('#password').val()) {
BookinglayerLogin.showValidationFieldError($('#password'),'Password missing');
return false;
}
if( $('#step-login').is(':visible') && !BookinglayerLogin.isValidEmailAddress($('#email').val())) {
BookinglayerLogin.showValidationFieldError($('#email'),'This email seems to be invalid.');
return false;
}
return true;
},
isValidEmailAddress: function(emailAddress) {
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
return pattern.test(emailAddress);
},
showValidationFieldError($field,message) {
$field.parents('.form-group:first').addClass('has-error').find('.help-block').text(message);
}
}
$(document).ready(function() {
$('#email').focus();
});
</script>
'
$scripts_for_layout = ''
$title_for_layout = 'Users'include - APP/View/Layouts/login.ctp, line 87 View::_evaluate() - APP/Vendor/cakephp/cakephp/lib/Cake/View/View.php, line 971 View::_render() - APP/Vendor/cakephp/cakephp/lib/Cake/View/View.php, line 933 View::renderLayout() - APP/Vendor/cakephp/cakephp/lib/Cake/View/View.php, line 546 View::render() - APP/Vendor/cakephp/cakephp/lib/Cake/View/View.php, line 481 Controller::render() - APP/Vendor/cakephp/cakephp/lib/Cake/Controller/Controller.php, line 960 Dispatcher::_invoke() - APP/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php, line 200 Dispatcher::dispatch() - APP/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php, line 167 [main] - APP/webroot/index.php, line 122