#37 working

parent 35b0f9f0
......@@ -17,6 +17,31 @@ function LoginCtrl(
$stateParams,
ngToast) {
// Return client browser. ex: $scope.clientBrowser == [ "Firefox", "51"]
$scope.clientBrowser = (function(){
var ua= navigator.userAgent, tem,
M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if(/trident/i.test(M[1])){
tem= /\brv[ :]+(\d+)/g.exec(ua) || [];
return 'IE '+(tem[1] || '');
}
if(M[1]=== 'Chrome'){
tem= ua.match(/\b(OPR|Edge)\/(\d+)/);
if(tem!= null) return tem.slice(1).join(' ').replace('OPR', 'Opera');
}
M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
return M.join(' ');
})().split(" ");
console.log($scope.clientBrowser);
// Return if client browser valid or not
$scope.validBrowser = false;
if($scope.clientBrowser[0] == "Firefox" && parseInt($scope.clientBrowser[1]) >= 52 )
$scope.validBrowser = true;
if($scope.clientBrowser[0] == "Chrome" && parseInt($scope.clientBrowser[1]) >= 51 )
$scope.validBrowser = true;
$scope.credentials = {
email: '',
password: '',
......@@ -85,13 +110,11 @@ function LoginCtrl(
$scope.submitted = false;
delete $window.sessionStorage.token;
if (err.search("without students") > 0) {
$translate('no_students_for_user').then(function (translation) {
ngToast.warning({ content: translation });
});
ngToast.warning($translate.instant('no_students_for_user'));
} else if (err.search("not been activated") > 0) {
$translate('inactive_account').then(function (translation) {
ngToast.danger({ content: translation });
});
ngToast.danger($translate.instant('inactive_account'));
} else {
ngToast.danger($translate.instant("login_fail"));
}
});
};
......
......@@ -11,6 +11,15 @@
</p>
</div>
</div>
<div class="row" ng-if="!validBrowser">
<div class="container">
<div class="alert alert-warning">
<strong>{{ 'warning' | translate}}!</strong> {{ 'warning_browser_incompatible' | translate}} <a href="https://www.mozilla.org/es-ES/firefox/new/" target="_blank">Mozilla Firefox</a> {{ 'or' | translate}} <a href="https://www.google.com/chrome/" target="_blank">Google Chrome</a>.
</div>
</div>
</div>
<div class="row">
<!-- Rejilla 3 elementos de igual ancho -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment