Skip to content

Commit

Permalink
Updated pages so that HTTPS is required for signing in
Browse files Browse the repository at this point in the history
  • Loading branch information
basicallydan committed Dec 11, 2015
1 parent 66894f1 commit 0846238
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -3,6 +3,7 @@
<head>
<title>Forkability</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="https://basicallydan.github.io/forkability" />
<link rel="stylesheet" type="text/css" href="pages/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="pages/bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="pages/font-awesome/css/font-awesome.min.css">
Expand Down
28 changes: 24 additions & 4 deletions pages/pages.js
Expand Up @@ -6,22 +6,42 @@ function getParameterByName(name) {
}

var rootPath = '/forkability';
var gitHubHost = 'basicallydan.github.io';
var onHTTPS = true;

if (/localhost/i.test(window.location.href)) {
rootPath = '/';
}

if ((window.location.host.test(gitHubHost)) && !(/https/i.test(window.location.protocol))) {
onHTTPS = false;
}

var loadPage = function() {
var currentUser;
var repoOptions = {};
var repos = [];

if (!onHTTPS) {
$('.sign-in').tooltip({
title: 'You can\'t sign in using unless you\'re on HTTPS. Click here to be redirected.',
placement: 'bottom'
});
}

$(document).on('click', '.sign-in', function(e) {
e.preventDefault();
authClient.login({
rememberMe: true,
scope: undefined
});
if (!onHTTPS) {
$(this).html('<i class="fa fa-github"></i> Redirecting to https...');
setTimeout(function () {
window.location.protocol = 'https';
}, 700);
} else {
authClient.login({
rememberMe: true,
scope: undefined
});
}
});

repoOptions.username = getParameterByName('u');
Expand Down

0 comments on commit 0846238

Please sign in to comment.