Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6ad31911
authored
Mar 06, 2017
by
Sebastián Collado Montañez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
#37
working
parent
35b0f9f0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
sails/src/assets/scripts/modules/login/controllers/login.js
sails/src/assets/scripts/modules/login/views/login.html
sails/src/assets/scripts/modules/login/controllers/login.js
View file @
6ad31911
...
...
@@ -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
=
/
\b
rv
[
:
]
+
(\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"
)
);
}
});
};
...
...
sails/src/assets/scripts/modules/login/views/login.html
100755 → 100644
View file @
6ad31911
...
...
@@ -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 -->
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment