#37 working

parent 35b0f9f0
...@@ -17,6 +17,31 @@ function LoginCtrl( ...@@ -17,6 +17,31 @@ function LoginCtrl(
$stateParams, $stateParams,
ngToast) { 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 = { $scope.credentials = {
email: '', email: '',
password: '', password: '',
...@@ -85,13 +110,11 @@ function LoginCtrl( ...@@ -85,13 +110,11 @@ function LoginCtrl(
$scope.submitted = false; $scope.submitted = false;
delete $window.sessionStorage.token; delete $window.sessionStorage.token;
if (err.search("without students") > 0) { if (err.search("without students") > 0) {
$translate('no_students_for_user').then(function (translation) { ngToast.warning($translate.instant('no_students_for_user'));
ngToast.warning({ content: translation });
});
} else if (err.search("not been activated") > 0) { } else if (err.search("not been activated") > 0) {
$translate('inactive_account').then(function (translation) { ngToast.danger($translate.instant('inactive_account'));
ngToast.danger({ content: translation }); } else {
}); ngToast.danger($translate.instant("login_fail"));
} }
}); });
}; };
......
...@@ -11,6 +11,15 @@ ...@@ -11,6 +11,15 @@
</p> </p>
</div> </div>
</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"> <div class="row">
<!-- Rejilla 3 elementos de igual ancho --> <!-- Rejilla 3 elementos de igual ancho -->
...@@ -47,7 +56,7 @@ ...@@ -47,7 +56,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="text-center margin-top15"> <div class="text-center margin-top15">
<br/> <br/>
<a href="/app/#/changepass" translate>password_forgotten</a> <a href="/app/#/changepass" translate>password_forgotten</a>
......
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