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
df6f0dd0
authored
Dec 28, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issue #724 fixed
parent
0bf177f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/controllers/StudentController.js
View file @
df6f0dd0
...
@@ -54,11 +54,12 @@ module.exports = {
...
@@ -54,11 +54,12 @@ module.exports = {
if
(
student
)
{
if
(
student
)
{
if
(
bcrypt
.
compareSync
(
req
.
body
.
password
,
student
.
password
))
{
if
(
bcrypt
.
compareSync
(
req
.
body
.
password
,
student
.
password
))
{
student
.
isStudent
=
true
;
student
.
isStudent
=
true
;
student
.
license
=
student
.
license
[
0
];
if
(
!
student
.
license
||
!
student
.
license
[
0
]
||
student
.
license
[
0
].
hasExpired
())
{
if
(
!
student
.
license
||
student
.
license
.
hasExpired
())
{
sails
.
log
.
error
(
`Tried to login with non valid license
${
req
.
body
.
username
}
`
);
sails
.
log
.
error
(
`Tried to login with non valid license
${
req
.
body
.
username
}
`
);
return
res
.
badRequest
(
"Student has an invalid license"
);
return
res
.
badRequest
(
"Student has an invalid license"
);
}
else
}
else
student
=
student
.
toObject
();
// to enable overwrite license field
student
.
license
=
student
.
license
[
0
];
return
res
.
ok
({
return
res
.
ok
({
user
:
student
,
user
:
student
,
token
:
sailsTokenAuth
.
issueToken
(
student
,
sails
.
config
.
jwt
.
expiresInMinutes
),
token
:
sailsTokenAuth
.
issueToken
(
student
,
sails
.
config
.
jwt
.
expiresInMinutes
),
...
...
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