summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2018-09-12 23:32:52 -0400
committerMitch Jackson <mitch@freeside.biz>2018-09-20 19:07:33 -0400
commit95e61b65bcf59209181fec43d760210a3846ce26 (patch)
treea2f7578e6b666427f7fecc3b04b2f90e28f485f6
parentb0371bd62e1963ce29aa3119a9d8c7ac710c911a (diff)
RT# 80624 Detect and warn for bad MS Edge version
-rw-r--r--httemplate/elements/header.html1
-rw-r--r--httemplate/misc/edge_browser_check-fail_notice.html25
-rw-r--r--httemplate/misc/edge_browser_check-header.html32
-rw-r--r--httemplate/misc/edge_browser_check-iframe.html35
4 files changed, 93 insertions, 0 deletions
diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html
index c6b10e3..6df45fb 100644
--- a/httemplate/elements/header.html
+++ b/httemplate/elements/header.html
@@ -4,3 +4,4 @@
% } else {
<& header-full.html, @_ &>
% }
+<& /misc/edge_browser_check-header.html &>
diff --git a/httemplate/misc/edge_browser_check-fail_notice.html b/httemplate/misc/edge_browser_check-fail_notice.html
new file mode 100644
index 0000000..fb42ffe
--- /dev/null
+++ b/httemplate/misc/edge_browser_check-fail_notice.html
@@ -0,0 +1,25 @@
+<& /elements/header.html, "Edge browser bug" &>
+
+<div id="edgebug" style="border: solid 1px #888; border-radius: 4px; margin: 5em; max-width: 400px; text-align: left; padding: 0 1em; background-color: #ffe; box-shadow: 2px 2px 4px">
+ <div style="text-align: center; font-size: 3em; color: #933; text-shadow: 1px 1px 2px black;">
+ &#9888;
+ </div>
+ <h4 style="border-bottom: solid 1px #888; margin: 1em 0; text-align: center;">
+ Edge Browser Bug
+ </h4>
+ <p>
+ Your copy of Microsoft Edge has a data corrupting bug.
+ </p>
+ <p>
+ Microsoft fixed this bug with the <b>July RS4 Windows 10 Update</b>.
+ Please update your copy of Windows.
+ </p>
+ <p>
+ Alternatively, you may choose to use
+ <a href="https://mozilla.org/en-US/firefox/new/">Mozilla Firefox</a>
+ or <a href="https://chrome.google.com">Google Chrome</a>. They
+ are not affected by this bug.
+ </p>
+</div>
+
+<& /elements/footer.html &> \ No newline at end of file
diff --git a/httemplate/misc/edge_browser_check-header.html b/httemplate/misc/edge_browser_check-header.html
new file mode 100644
index 0000000..4d36de5
--- /dev/null
+++ b/httemplate/misc/edge_browser_check-header.html
@@ -0,0 +1,32 @@
+% if ( $force_redirect ) {
+ <script type="text/javascript">
+ if ( <% $DEBUG %> || /Edge\/17\.17134/.test( navigator.userAgent )) {
+ if ( window.location.href.indexOf("fail_notice") == -1 ) {
+ window.location.href = "<% $fsurl %>misc/edge_browser_check-fail_notice.html";
+ }
+ }
+ </script>
+% }
+% if ( $do_check ) {
+ <iframe id="edge_browser_check_iframe" style="display:none;"></iframe>
+ <script type="text/javascript">
+ if ( <% $DEBUG %> || /Edge\/17\.17134/.test( navigator.userAgent )) {
+ $("#edge_browser_check_iframe").attr(
+ 'src',
+ '<% $fsurl %>misc/edge_browser_check-iframe.html?edge_browser_check=1'
+ );
+ }
+ </script>
+% }
+<%init>
+my $curuser = $FS::CurrentUser::CurrentUser;
+my $cgi = FS::UID::cgi();
+my $DEBUG = 0;
+
+my $do_check = 0;
+$do_check = 1
+ if $curuser
+ && $curuser->get_pref('edge_bug_vulnerable') ne 'N';
+
+my $force_redirect = $curuser->get_pref('edge_bug_vulnerable') eq 'Y' ? 1 : 0;
+</%init> \ No newline at end of file
diff --git a/httemplate/misc/edge_browser_check-iframe.html b/httemplate/misc/edge_browser_check-iframe.html
new file mode 100644
index 0000000..da411c6
--- /dev/null
+++ b/httemplate/misc/edge_browser_check-iframe.html
@@ -0,0 +1,35 @@
+<form id="canary-form" action="<% $fsurl %>misc/edge_browser_check-iframe.html" method="POST">
+<input type="text" id="canary-result" value="<% scalar $cgi->param('edge_browser_canary') %>">
+<select name="edge_browser_canary">
+ <option>test
+ <option>test
+</select>
+<input id="canary-submit" type="submit">
+</form>
+
+<script type="text/javascript" src="<% $fsurl %>elements/jquery.js"></script>
+<script type="text/javascript">
+ $( function() {
+ if ( ! $("#canary-result").val() ) {
+ $("#canary-form").submit();
+ }
+ });
+</script>
+
+<%init>
+my $cgi = FS::UID::cgi();
+my $curuser = $FS::CurrentUser::CurrentUser;
+
+if ( $curuser ) {
+ my $canary = $cgi->param('edge_browser_canary');
+ $curuser->set_pref(
+ 'edge_bug_vulnerable',
+
+ $canary eq 'test' ? 'N' : 'Y',
+
+ # Don't test this user's session for the next 5m
+ time() + 300,
+ );
+}
+
+</%init> \ No newline at end of file