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
a531b792
authored
May 28, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issues
#213
#238
and
#240
fixed
parent
297f8a63
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
sails/src/api/controllers/SupervisorController.js
sails/src/api/models/Supervisor.js
sails/src/assets/scripts/modules/student/controllers/collections.js
sails/src/assets/scripts/modules/student/views/setup.html
sails/src/api/controllers/SupervisorController.js
View file @
a531b792
...
...
@@ -479,10 +479,10 @@ module.exports = {
.
then
(
function
(
supervisor
)
{
if
(
!
supervisor
)
return
res
.
notFound
();
delete
supervisor
.
password
;
if
(
req
.
body
.
password
&&
req
.
body
.
password
.
length
>
0
)
supervisor
.
password
=
req
.
body
.
password
;
else
delete
supervisor
.
password
;
console
.
log
(
supervisor
.
password
);
supervisor
.
name
=
req
.
body
.
name
||
supervisor
.
name
;
supervisor
.
surname
=
req
.
body
.
surname
||
supervisor
.
surname
;
supervisor
.
gender
=
req
.
body
.
gender
||
supervisor
.
gender
;
...
...
@@ -739,9 +739,13 @@ module.exports = {
delete
:
function
(
req
,
res
)
{
if
(
!
req
.
params
.
id
)
return
res
.
badRequest
(
"Missing parameter"
);
StuSup
.
destroy
({
id_sup
:
req
.
params
.
id
})
.
then
(()
=>
{
Supervisor
.
destroy
({
id
:
req
.
params
.
id
})
.
then
(()
=>
{
res
.
ok
()})
.
catch
((
err
)
=>
{
res
.
serverError
(
"Could not delete supervisor"
)});
.
catch
((
err
)
=>
{
console
.
log
(
err
);
res
.
serverError
(
"Could not delete supervisor"
)});
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
res
.
serverError
(
"Could not delete supervisor"
)});
}
};
sails/src/api/models/Supervisor.js
View file @
a531b792
...
...
@@ -190,6 +190,9 @@ module.exports = {
Supervisor
.
findOne
({
email
:
attrs
.
email
}).
then
(
function
(
supervisor
)
{
if
(
supervisor
&&
supervisor
.
id
!==
attrs
.
id
)
{
cb
(
new
Error
(
'Email being used'
));
}
else
if
(
attrs
.
password
&&
attrs
.
password
.
length
>
0
&&
attrs
.
password
==
supervisor
.
password
)
{
delete
attrs
.
password
;
cb
();
}
else
{
cb
();
}
...
...
@@ -203,8 +206,9 @@ module.exports = {
var
bcrypt
=
require
(
'bcrypt-nodejs'
);
if
(
attrs
.
password
&&
attrs
.
password
.
length
>
0
)
{
attrs
.
password
=
bcrypt
.
hashSync
(
attrs
.
password
,
bcrypt
.
genSaltSync
());
}
else
}
else
{
delete
attrs
.
password
;
}
cb
();
}
],
...
...
sails/src/assets/scripts/modules/student/controllers/collections.js
View file @
a531b792
...
...
@@ -697,6 +697,14 @@ dashboardControllers.controller('StudentCollectionsCtrl', function StudentCollec
$scope
.
$apply
();
});
// unsubscribe sockets when leaving
$rootScope
.
$on
(
'$stateChangeStart'
,
function
(
event
,
toState
,
toParams
,
fromState
,
fromParams
)
{
io
.
socket
.
off
(
'scene'
);
io
.
socket
.
off
(
'vocabulary'
);
}
);
// Load pictos
$scope
.
showActiveScene
();
$scope
.
loadScenesList
();
...
...
sails/src/assets/scripts/modules/student/views/setup.html
View file @
a531b792
...
...
@@ -56,7 +56,7 @@
<div
class=
"row"
>
<div
class=
"col-xs-2"
><i
class=
"fa fa-info-circle fa-lg"
aria-hidden=
"true"
></i></div>
<div
class=
"col-xs-10"
>
<h4
class=
"alert-heading"
>
{{ 'license_expires' | translate }}
<b>
{{ studentData.expiration_date }}
</b>
</h4
>
{{ 'license_expires' | translate }}
<b>
{{ studentData.expiration_date }}
</b
>
</div>
</div>
</div>
...
...
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