Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Closes #382. Detect if browser supports cookies.
It uses the cookie detection module in lib. Sets a cookie => redirects determines if cookie was set in subsequent request => issues warning if not set.
- Loading branch information
Showing
6 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# detects if cookies are enabled in the user's browser, by attempting to read/write a cookie. | ||
|
||
module CookieDetection | ||
|
||
protected | ||
|
||
# true if cookies are enabled, false otherwise. | ||
def cookies_enabled | ||
return true unless cookies["cookieTest"].blank? | ||
cookies["cookieTest"] = Time.now | ||
session[:return_to] = request.fullpath | ||
if cookies["cookie_test"].blank? | ||
return false | ||
end | ||
return true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters