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
71a8171b
authored
Aug 02, 2017
by
Germán Callejas Alcántara
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'newsignup' of
http://gitlab.ujaen.es/yotta/pictogram
into newsignup
parents
087ffc09
93fada03
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
62 deletions
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/scripts/modules/login/controllers/login.js
sails/src/assets/scripts/modules/login/controllers/signin.js
sails/src/assets/scripts/modules/login/views/login.html
sails/src/assets/styles/main.css
sails/src/assets/app/i18n/en-gb.json
View file @
71a8171b
{
{
"account"
:
"Account"
,
"account"
:
"Account"
,
"account_activate"
:
"The account has been activated"
,
"account_activate"
:
"The account has been activated"
,
"account_desc_office"
:
"Manage students, intervention teams along with all therapist related functionalities."
,
"account_desc_therapist"
:
"Manage pictograms, devices, record supervised sessions and get progress reports."
,
"account_desc_tutor"
:
"Configure your child's pictograms and his/her communication device."
,
"account_no_activate"
:
"The account could not be activated"
,
"account_no_activate"
:
"The account could not be activated"
,
"action-add"
:
"Add picto"
,
"action-add"
:
"Add picto"
,
"action-delete"
:
"Delete picto"
,
"action-delete"
:
"Delete picto"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
71a8171b
{
{
"account"
:
"Cuenta"
,
"account"
:
"Cuenta"
,
"account_activate"
:
"La cuenta ha sido activada"
,
"account_activate"
:
"La cuenta ha sido activada"
,
"account_desc_office"
:
"Gestione alumnos y equipos de intervención, además de todas las funcionalidades propias de un terapeuta."
,
"account_desc_tutor"
:
"Gestione los pictogramas de su hijo o hija y configure su dispositivo de comunicación."
,
"account_desc_therapist"
:
"Gestione pictogramas, dispositivos, grabe sesiones de terapia y obtenga estadísticas de progreso."
,
"account_no_activate"
:
"La cuenta no se ha podido activar"
,
"account_no_activate"
:
"La cuenta no se ha podido activar"
,
"action-add"
:
"Añade picto"
,
"action-add"
:
"Añade picto"
,
"action-delete"
:
"Elimina picto"
,
"action-delete"
:
"Elimina picto"
,
...
...
sails/src/assets/scripts/modules/login/controllers/login.js
View file @
71a8171b
...
@@ -17,8 +17,11 @@ function LoginCtrl(
...
@@ -17,8 +17,11 @@ function LoginCtrl(
config
,
config
,
$stateParams
,
$stateParams
,
$timeout
,
$timeout
,
ngToast
)
{
ngToast
,
CONSTANTS
,
vcRecaptchaService
)
{
/* Slider object */
$scope
.
slide
=
{
$scope
.
slide
=
{
state
:
'login'
,
state
:
'login'
,
prev
:
'login'
,
prev
:
'login'
,
...
@@ -40,51 +43,32 @@ function LoginCtrl(
...
@@ -40,51 +43,32 @@ function LoginCtrl(
}
}
};
};
/*
LOGIN --------------------------
*/
/* Login credentials */
$scope
.
credentials
=
{
$scope
.
credentials
=
{
email
:
''
,
email
:
''
,
password
:
''
,
password
:
''
,
lang
:
'es-es'
lang
:
'es-es'
};
};
$scope
.
office
=
{
/* Login function */
logoUrl
:
'img/logo_pictogram.png'
,
name
:
'Pictogram'
};
// Corporate login, office code has been passed
if
(
$stateParams
.
office
)
{
$http
.
get
(
config
.
backend
+
'/office/'
+
$stateParams
.
office
)
.
success
(
function
(
data
)
{
$scope
.
office
=
data
;
});
}
$scope
.
login
=
function
()
{
$scope
.
login
=
function
()
{
$scope
.
submitted
=
true
;
$scope
.
submitted
=
true
;
$http
$http
.
post
(
config
.
backend
+
'/sup/login'
,
$scope
.
credentials
)
.
post
(
config
.
backend
+
'/sup/login'
,
$scope
.
credentials
)
.
success
(
function
(
data
)
{
.
success
(
function
(
data
)
{
// default logo to Pictogram logo
data
.
user
.
isTutor
=
data
.
user
.
role
==
'tutor'
;
if
(
!
data
.
user
.
office
)
{
data
.
user
.
office
=
$scope
.
office
;
data
.
user
.
isTutor
=
true
;
}
else
data
.
user
.
isTutor
=
false
;
if
(
data
.
user
.
office
.
logoUrl
.
length
<
5
)
data
.
user
.
office
.
logoUrl
=
'img/logo_pictogram.png'
;
$window
.
sessionStorage
.
token
=
data
.
token
;
$window
.
sessionStorage
.
token
=
data
.
token
;
//User data correct
//User data correct
if
(
data
.
user
)
{
if
(
data
.
user
)
{
// Adapt language en-us to en-gb (the latter is the one supported for 'en')
// Adapt language en-us to en-gb (the latter is the one supported for 'en')
if
(
data
.
user
.
lang
===
'en-us'
)
{
if
(
data
.
user
.
lang
===
'en-us'
)
data
.
user
.
lang
=
'en-gb'
;
data
.
user
.
lang
=
'en-gb'
;
}
//Update $scope
$scope
.
lang
=
data
.
user
.
lang
;
$scope
.
lang
=
data
.
user
.
lang
;
//Update $translate
$translate
.
use
(
$scope
.
lang
);
$translate
.
use
(
$scope
.
lang
);
}
else
{
}
else
{
//No user data, use default lang
//No user data, use default lang
...
@@ -93,10 +77,7 @@ function LoginCtrl(
...
@@ -93,10 +77,7 @@ function LoginCtrl(
// Change
// Change
$window
.
sessionStorage
.
user
=
JSON
.
stringify
(
data
.
user
);
$window
.
sessionStorage
.
user
=
JSON
.
stringify
(
data
.
user
);
ngToast
.
success
(
$translate
(
'login_success'
));
$translate
(
'login_success'
).
then
(
function
(
translation
)
{
ngToast
.
success
({
content
:
translation
});
});
// Name in login success message
// Name in login success message
$scope
.
name
=
data
.
user
.
name
;
$scope
.
name
=
data
.
user
.
name
;
...
@@ -107,13 +88,69 @@ function LoginCtrl(
...
@@ -107,13 +88,69 @@ function LoginCtrl(
.
error
(
function
(
err
)
{
.
error
(
function
(
err
)
{
$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
)
ngToast
.
warning
(
$translate
.
instant
(
'no_students_for_user'
));
ngToast
.
warning
(
$translate
.
instant
(
'no_students_for_user'
));
}
else
if
(
err
.
search
(
"not been activated"
)
>
0
)
{
else
if
(
err
.
search
(
"not been activated"
)
>
0
)
ngToast
.
danger
(
$translate
.
instant
(
'inactive_account'
));
ngToast
.
danger
(
$translate
.
instant
(
'inactive_account'
));
}
else
{
else
ngToast
.
danger
(
$translate
.
instant
(
"login_fail"
));
ngToast
.
danger
(
$translate
.
instant
(
"login_fail"
));
}
});
});
};
};
/*
SIGNUP ------------------------------
*/
/* form data */
var
formdata_empty
=
{
name
:
''
,
email
:
''
,
password
:
''
,
password_confirm
:
''
,
lang
:
'00'
,
role
:
''
,
};
$scope
.
minlength
=
CONSTANTS
.
password_minlength
;
$scope
.
reset
=
function
()
{
$scope
.
formdata
=
formdata_empty
;
};
$scope
.
reset
();
// Signup form submit
$scope
.
signup
=
function
()
{
if
(
$scope
.
formdata
.
password
.
length
<
CONSTANTS
.
password_minlength
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'password_short'
,
{
minlength
:
CONSTANTS
.
password_minlength
})
});
return
;
}
if
(
!
$scope
.
formdata
.
disclaimer_accepted
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'disclaimer_requested'
)
});
return
;
}
if
(
!
$scope
.
formdata
.
role
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'case_requested'
)
});
return
;
}
if
(
!
$scope
.
signInForm
.
$valid
)
return
;
$http
.
post
(
config
.
backend
+
'/sup'
,
$scope
.
formdata
)
.
success
(
function
()
{
ngToast
.
success
({
content
:
$translate
.
instant
(
'user_created'
,
{
name
:
$scope
.
formdata
.
name
,
surname
:
$scope
.
formdata
.
surname
})
});
$scope
.
reset
();
})
.
error
(
function
()
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'user_exists'
,
{
email
:
$scope
.
formdata
.
email
})
});
});
};
});
});
sails/src/assets/scripts/modules/login/controllers/signin.js
View file @
71a8171b
...
@@ -47,29 +47,8 @@ function SignInCtrl($scope,
...
@@ -47,29 +47,8 @@ function SignInCtrl($scope,
$scope
.
reset
();
$scope
.
reset
();
// Get the list of offices
// Signup form submit
$http
$scope
.
signup
=
function
()
{
.
get
(
config
.
backend
+
'/office/get_all'
)
.
success
(
function
(
offices
)
{
$scope
.
offices
=
offices
;
})
.
error
(
function
()
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'server_error'
)
});
});
// Copy fields from supervisor to office
$scope
.
copyFields
=
function
()
{
$scope
.
formdata
.
office
.
address
=
$scope
.
formdata
.
address
;
$scope
.
formdata
.
office
.
postalCode
=
$scope
.
formdata
.
postalCode
;
$scope
.
formdata
.
office
.
country
=
$scope
.
formdata
.
country
;
$scope
.
formdata
.
office
.
lang
=
$scope
.
formdata
.
lang
;
$scope
.
formdata
.
office
.
email
=
$scope
.
formdata
.
email
;
$scope
.
formdata
.
office
.
phone1
=
$scope
.
formdata
.
phone
;
$scope
.
formdata
.
office
.
contactPerson
=
$scope
.
formdata
.
name
+
" "
+
$scope
.
formdata
.
surname
;
};
// Form submit
$scope
.
signin
=
function
()
{
// Validate email match
// Validate email match
if
(
$scope
.
formdata
.
email
!==
$scope
.
formdata
.
email_confirm
)
{
if
(
$scope
.
formdata
.
email
!==
$scope
.
formdata
.
email_confirm
)
{
ngToast
.
danger
({
content
:
$translate
.
instant
(
'email_match'
)
});
ngToast
.
danger
({
content
:
$translate
.
instant
(
'email_match'
)
});
...
...
sails/src/assets/scripts/modules/login/views/login.html
View file @
71a8171b
This diff is collapsed.
Click to expand it.
sails/src/assets/styles/main.css
View file @
71a8171b
...
@@ -1103,6 +1103,12 @@ input.editable.scene-name {
...
@@ -1103,6 +1103,12 @@ input.editable.scene-name {
float
:
right
;
float
:
right
;
}
}
/* Cambiar tamaño imagen */
.small-img
{
margin-top
:
25px
;
width
:
200px
;
}
/* Estilos para ngSwitch */
/* Estilos para ngSwitch */
.switch-panel-body
{
.switch-panel-body
{
position
:
relative
;
position
:
relative
;
...
...
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