Skip to content

Commit

Permalink
Require HTTPS
Browse files Browse the repository at this point in the history
  • Loading branch information
abuturla committed Feb 14, 2017
1 parent 1c2cf4d commit 7531dd7
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions widget/app.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,32 +58,8 @@
}])
.factory('LoyaltyAPI', ['$q', 'STATUS_CODE', 'STATUS_MESSAGES', 'SERVER', '$http',
function ($q, STATUS_CODE, STATUS_MESSAGES, SERVER, $http) {
var requiresHttps = function () {
var useHttps = false;
var userAgent = navigator.userAgent || navigator.vendor;
var isiPhone = (/(iPhone|iPod|iPad)/i.test(userAgent));
var isAndroid = (/android/i.test(userAgent));

//iOS 10 and higher should use HTTPS
if (isiPhone) {
//This checks the first digit of the OS version. (Doesn't distinguish between 1 and 10)
if (!(/OS [4-9](.*) like Mac OS X/i.test(userAgent))) {
useHttps = true;
}
}

//For web based access, use HTTPS
if (!isiPhone && !isAndroid) {
useHttps = true;
}

console.warn('userAgent: ' + userAgent);
console.warn('useHttps: ' + useHttps);

return useHttps;
};
var getProxyServerUrl = function () {
return requiresHttps() ? SERVER.URL : SERVER.httpURL;
return SERVER.URL;
};
var addApplication = function (app) {
var deferred = $q.defer();
Expand Down

0 comments on commit 7531dd7

Please sign in to comment.