Browse Source

Added https redirect for unauthorised users

Remove mixed content warning
master
Igor Zhukov 10 years ago
parent
commit
9e8425bb71
  1. 33
      app/js/controllers.js
  2. 1
      app/js/locales/en-us.json
  3. 4
      app/partials/desktop/confirm_modal.html

33
app/js/controllers.js

@ -33,6 +33,10 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -33,6 +33,10 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$location.url('/im');
return;
}
if (location.protocol == 'http:' &&
(location.host == 'zhukov.github.io' || location.host == 'web.telegram.org')) {
location = 'https://web.telegram.org';
}
});
var options = {dcID: 2, createNetworker: true},
countryChanged = false,
@ -80,17 +84,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -80,17 +84,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
if (nearestDcResult.nearest_dc != nearestDcResult.this_dc) {
MtpApiManager.getNetworker(nearestDcResult.nearest_dc, {createNetworker: true});
}
}, function (error) {
switch (error.type) {
case 'NETWORK_BAD_REQUEST':
if (location.protocol == 'https:') {
ErrorService.confirm({type: 'HTTPS_MIXED_FAIL'}).then(function () {
location = location.toString().replace(/^https:/, 'http:');
});
error.handled = true;
}
break;
}
});
}
@ -218,15 +211,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -218,15 +211,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
$scope.progress.enabled = false;
console.log('sendCode error', error);
switch (error.type) {
case 'NETWORK_BAD_REQUEST':
if (location.protocol == 'https:') {
ErrorService.confirm({type: 'HTTPS_MIXED_FAIL'}).then(function () {
location = location.toString().replace(/^https:/, 'http:');
});
error.handled = true;
}
break;
case 'PHONE_NUMBER_INVALID':
$scope.error = {field: 'phone'};
error.handled = true;
@ -617,15 +601,6 @@ angular.module('myApp.controllers', ['myApp.i18n']) @@ -617,15 +601,6 @@ angular.module('myApp.controllers', ['myApp.i18n'])
return result;
}, function (error) {
if (error.type == 'NETWORK_BAD_REQUEST') {
if (location.protocol == 'https:') {
ErrorService.confirm({type: 'HTTPS_MIXED_FAIL'}).then(function () {
location = location.toString().replace(/^https:/, 'http:');
});
error.handled = true;
}
}
if (error.code == 401) {
MtpApiManager.logOut()['finally'](function () {
location.hash = '/login';

1
app/js/locales/en-us.json

@ -119,7 +119,6 @@ @@ -119,7 +119,6 @@
"confirm_modal_update_reload": "A new version of Telegram Web has been downloaded. Launch it?",
"confirm_modal_history_flush": "Are you sure? This can not be undone!",
"confirm_modal_terminate_sessions": "Are you sure you want to log out all devices except for the current one?",
"confirm_modal_mixed_content_fail_http_redirect_md": "Your browser {moz-link: does not support} mixed content which is neccessary for MTProto support on https. {issue-link: Learn more}\n\n Would you like to use http-version instead?",
"confirm_modal_clipboard_file_send": "Are you sure to send file(s) from clipboard?",
"confirm_modal_clipboard_X_files_send": "{'one': 'Are you sure to send file from clipboard?', 'other': 'Are you sure to send {} files from clipboard?'}",
"confirm_modal_message_delete": "Are you sure you want to delete the message?",

4
app/partials/desktop/confirm_modal.html

@ -9,10 +9,6 @@ @@ -9,10 +9,6 @@
<span ng-switch-when="WEBOGRAM_UPDATED_RELOAD" my-i18n="confirm_modal_update_reload"></span>
<span ng-switch-when="HISTORY_FLUSH" my-i18n="confirm_modal_history_flush"></span>
<span ng-switch-when="TERMINATE_SESSIONS" my-i18n="confirm_modal_terminate_sessions"></span>
<span ng-switch-when="HTTPS_MIXED_FAIL" my-i18n="confirm_modal_mixed_content_fail_http_redirect_md">
<my-i18n-param name="moz-link"><a href="http://mzl.la/13jCUSU" target="_blank">{0}</a></my-i18n-param>
<my-i18n-param name="issue-link"><a href="https://github.com/zhukov/webogram/issues/237" target="_blank">{0} &raquo;</a></my-i18n-param>
</span>
<span ng-switch-when="FILES_CLIPBOARD_PASTE">
<ng-pluralize count="files.length"

Loading…
Cancel
Save