Added cookie disabled warning

If user has cookie disabled let them know
using a visual alert.
Also disallow login

Change-Id: I8f1ea3641beefbcef7d6c03fc36400fba73a29d4
This commit is contained in:
Sebastian Marcet 2018-05-08 12:06:20 -03:00
parent 3b1f9de37f
commit 6334083ee2
2 changed files with 24 additions and 3 deletions

View File

@ -1,8 +1,24 @@
jQuery(document).ready(function($){
$('#login_form').submit(function(){
$('#login_form').submit(function(event){
if(!navigator.cookieEnabled){
event.preventDefault();
checkCookiesEnabled();
return false;
}
$('.btn-primary').attr('disabled', 'disabled');
return true;
});
});
checkCookiesEnabled();
});
function checkCookiesEnabled(){
var cookieEnabled = navigator.cookieEnabled;
return cookieEnabled || showCookieFail();
}
function showCookieFail(){
$('#cookies-disabled-dialog').show();
}

View File

@ -15,6 +15,12 @@
@endif
</legend>
@endif
<div id="cookies-disabled-dialog" class="alert alert-warning alert-dismissible" style="display: none;" role="alert">
<button type="button" class="close"onclick="$('#cookies-disabled-dialog').hide()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Warning!</strong> Cookies are not enabled, please enabled them in order to use OpenStackId.
</div>
<div class="col-md-4" id="sidebar">
<div class="well">
{!! Form::open(array('id'=>'login_form','url' => URL::action('UserController@postLogin'), 'method' => 'post', "autocomplete" => "off")) !!}
@ -80,7 +86,6 @@
</fieldset>
{!! Form::close() !!}
</div>
</div>
<div class="col-md-8">
</div>