Skip to content

Commit

Permalink
Cookies should use the session Fixes #29
Browse files Browse the repository at this point in the history
  • Loading branch information
JayWood committed Sep 6, 2015
1 parent 73b7eec commit 668687c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions js/cwv3.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,23 @@ window.cwv3 = ( function( window, document, $ ){
app.set_cookie = function( method ){
// Set the cookie
method = method === 'exit' ? 'denied' : true;
$.cookie( app.cookie_name, method, {
var cookie_data = {
expires : parseInt( cwv3_params.cookie_time ),
path : cwv3_params.cookie_path,
});
};

// Should work with sessions
if ( 0 === cookie_data.expires ) {
cookie_data.expires = null;
}

$.cookie( app.cookie_name, method, cookie_data );
};

app.log = function() {
if ( window.console ) {
window.console.log( Array.prototype.slice.call( arguments ) );
}
};

app.close_handler = function(){
Expand All @@ -113,9 +126,9 @@ window.cwv3 = ( function( window, document, $ ){
};

app.dialog_switch = function(){
if( 'denied' === app.cookie_data && '' !== cwv3_params.denial_enabled ){
if( 'denied' === app.cookie_data ){
app.$auth.remove(); // Remove the main dialog
if( 'redirect' === cwv3_params.denial_method ){
if( 'redirect' === cwv3_params.denial_method && '' !== cwv3_params.denial_enabled ){
window.location.replace( app.redirect_url );
} else {
app.show_popup();
Expand Down
2 changes: 1 addition & 1 deletion js/cwv3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 comment on commit 668687c

@JayWood
Copy link
Owner Author

@JayWood JayWood commented on 668687c Sep 6, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also adds a logging method for later.

Please sign in to comment.