Skip to content

Commit c192b71

Browse files
authored
Merge pull request #162 from lucas1004jx/issue#152_login
Issue#152 login.html
2 parents 5f21b4c + 3a17e7c commit c192b71

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

app/views/login.html

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,31 +145,28 @@
145145
<script type="application/javascript">
146146
document.write("<script src='http://" + (location.host || "localhost").split(":")[0] + ":35729/livereload.js'></" + "script>");
147147

148-
function areCookiesEnabled() {
149-
var cookieEnabled = navigator.cookieEnabled;
148+
const areCookiesEnabled = () => {
149+
const cookieEnabled = navigator.cookieEnabled;
150150

151151
// When cookieEnabled flag is present and false then cookies are disabled.
152-
if (cookieEnabled === false) {
153-
return false;
154-
}
152+
if (!cookieEnabled) return false;
155153

156154
// try to set a test cookie if we can't see any cookies and we're using
157155
// either a browser that doesn't support navigator.cookieEnabled
158156
// or IE (which always returns true for navigator.cookieEnabled)
159-
if (!document.cookie && (cookieEnabled === null || /*@cc_on!@*/ false)) {
157+
if (!document.cookie && cookieEnabled === null) {
160158
document.cookie = "testcookie=1";
161159

162-
if (!document.cookie) {
163-
return false;
164-
} else {
165-
document.cookie = "testcookie=; expires=" + new Date(0).toUTCString();
166-
}
160+
if (!document.cookie) return false;
161+
162+
document.cookie = "testcookie=; expires=" + new Date(0).toUTCString();
163+
167164
}
168165

169166
return true;
170167
}
171168

172-
$(document).ready(function() {
169+
$(document).ready(() => {
173170
if (!areCookiesEnabled()) {
174171
$("#page-wrapper").prepend("<div class=\"row\"><div class=\"col-lg-12\"><div class=\"alert alert-danger\">Cookies are not enabled on your browser. Please enable cookies in your browser preferences to continue.</div></div></div>");
175172
}

0 commit comments

Comments
 (0)