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
812f0a28
authored
Jan 05, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Error in stu/login fixed
parent
b6938fcc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/controllers/StudentController.js
View file @
812f0a28
...
...
@@ -62,18 +62,18 @@ module.exports = {
student
.
isStudent
=
true
;
if
(
!
student
.
license
||
!
student
.
license
[
0
])
{
sails
.
log
.
error
(
`Tried to login with non valid license
${
req
.
body
.
username
}
`
);
}
else
res
.
unauthorized
(
"Student has an invalid license"
);
}
else
{
var
hasExpired
=
student
.
license
[
0
].
hasExpired
();
student
=
student
.
toObject
();
// to enable overwrite license field
student
.
license
=
student
.
license
[
0
];
if
(
student
.
license
[
0
].
hasExpired
())
student
.
license
.
expired
=
true
;
else
student
.
license
.
expired
=
false
;
student
.
license
.
expired
=
hasExpired
;
return
res
.
ok
({
user
:
student
,
token
:
sailsTokenAuth
.
issueToken
(
student
,
sails
.
config
.
jwt
.
expiresInMinutes
),
server_time
:
(
new
Date
()).
getTime
()
});
}
}
else
{
sails
.
log
.
error
(
`Invalid student login: user
${
student
.
username
}
, password\
"
${
req
.
body
.
password
}
"`
);
...
...
@@ -84,8 +84,8 @@ module.exports = {
res
.
notFound
(
"Student not found"
);
}
})
.
catch
(
function
()
{
sails
.
log
.
error
(
`Error getting student
${
req
.
body
.
username
}
for login
`
);
.
catch
(
function
(
err
)
{
sails
.
log
.
error
(
`Error getting student
${
req
.
body
.
username
}
for login
: `
+
err
);
res
.
serverError
(
"Error when connecting to database"
);
});
},
...
...
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