Commit 71a8171b by Germán Callejas Alcántara

Merge branch 'newsignup' of http://gitlab.ujaen.es/yotta/pictogram into newsignup

parents 087ffc09 93fada03
{
"account": "Account",
"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",
"action-add": "Add picto",
"action-delete": "Delete picto",
......
{
"account": "Cuenta",
"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",
"action-add": "Añade picto",
"action-delete": "Elimina picto",
......
......@@ -17,8 +17,11 @@ function LoginCtrl(
config,
$stateParams,
$timeout,
ngToast) {
ngToast,
CONSTANTS,
vcRecaptchaService) {
/* Slider object */
$scope.slide = {
state: 'login',
prev: 'login',
......@@ -40,51 +43,32 @@ function LoginCtrl(
}
};
/*
LOGIN --------------------------
*/
/* Login credentials */
$scope.credentials = {
email: '',
password: '',
lang: 'es-es'
};
$scope.office = {
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;
});
}
/* Login function */
$scope.login = function () {
$scope.submitted = true;
$http
.post(config.backend + '/sup/login', $scope.credentials)
.success(function (data) {
// default logo to Pictogram logo
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';
data.user.isTutor = data.user.role == 'tutor';
$window.sessionStorage.token = data.token;
//User data correct
if (data.user) {
// 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';
}
//Update $scope
$scope.lang = data.user.lang;
//Update $translate
$translate.use($scope.lang);
} else {
//No user data, use default lang
......@@ -93,10 +77,7 @@ function LoginCtrl(
// Change
$window.sessionStorage.user = JSON.stringify(data.user);
$translate('login_success').then(function (translation) {
ngToast.success({ content: translation });
});
ngToast.success($translate('login_success'));
// Name in login success message
$scope.name = data.user.name;
......@@ -107,13 +88,69 @@ function LoginCtrl(
.error(function (err) {
$scope.submitted = false;
delete $window.sessionStorage.token;
if (err.search("without students") > 0) {
if (err.search("without students") > 0)
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'));
} else {
else
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}) });
});
};
});
......@@ -47,29 +47,8 @@ function SignInCtrl($scope,
$scope.reset();
// Get the list of offices
$http
.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 () {
// Signup form submit
$scope.signup = function () {
// Validate email match
if ($scope.formdata.email !== $scope.formdata.email_confirm) {
ngToast.danger({ content: $translate.instant('email_match') });
......
......@@ -2,7 +2,7 @@
<div class="header-image">
<div class="row">
<div class="col-md-12 text-center">
<img ng-src="{{office.logoUrl}}" alt="{{office.name}}" title="{{office.name}}">
<img ng-src="img/logo_pictogram.png" alt="Pictogram" title="Pictogram">
</div>
</div>
</div>
......@@ -86,38 +86,59 @@
</div>
</div>
<form name="signupForm" role="form" ng-submit="signup()">
<!--
SLIDE 2: Account selection
-->
<div ng-class="slide.back ? 'switch-animation-back' : 'switch-animation'" ng-switch-when="accounts">
<h2 translate>select_account</h2>
<div class="row">
<div class="col-md-4">
<legend translate>parents_tutor</legend>
<div class="text-center">
<a ng-click="slide.rightTo('tutor')"><img src="img/parents.png" alt="{{'parents_tutor' | translate}}" title="{{'parents_tutor' | translate}}" /></a>
</div>
<div>
<p translate>tutor_account_desc</p>
<a ng-click="slide.rightTo('tutor'); formdata.role = 'tutor'">
<img src="img/parents.png" alt="{{'parents_tutor' | translate}}" title="{{'parents_tutor' | translate}}"
ng-class="{'small-img': hover_tutor}"
ng-mouseenter="hover_tutor = true"
ng-mouseleave="hover_tutor = false"/>
</a>
</div>
</div>
<div class="col-md-4">
<legend translate>therapist</legend>
<div class="text-center">
<a ng-click="slide.rightTo('therapist')"><img src="img/therapist.png" alt="{{'therapist' | translate}}" title="{{'therapist' | translate}}" /></a>
</div>
<div>
<p translate>therapist_account_desc</p>
<a ng-click="slide.rightTo('therapist'); formdata.role = 'therapist'">
<img src="img/therapist.png" alt="{{'therapist' | translate}}" title="{{'therapist' | translate}}"
ng-class="{'small-img': hover_therapist}"
ng-mouseenter="hover_therapist = true"
ng-mouseleave="hover_therapist = false"/>
</a>
</div>
</div>
<div class="col-md-4">
<legend translate>office_center</legend>
<div class="text-center">
<a ng-click="slide.rightTo('office')"><img src="img/office.jpg" alt="{{'office_center' | translate}}" title="{{'office_center' | translate}}" /></a>
<a ng-click="slide.rightTo('office'); formdata.role = 'office'">
<img src="img/office.jpg" alt="{{'office_center' | translate}}" title="{{'office_center' | translate}}"
ng-class="{'small-img': hover_office}"
ng-mouseenter="hover_office = true"
ng-mouseleave="hover_office = false"/>
</a>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<p translate>account_desc_tutor</p>
</div>
<div>
<p translate>office_account_desc</p>
<div class="col-md-4">
<p translate>account_desc_therapist</p>
</div>
<div class="col-md-4">
<p translate>account_desc_office</p>
</div>
</div>
</div>
......@@ -135,16 +156,17 @@
<input type="hidden" ng-model="formdata.role" value="tutor"></input>
<div class="form-group">
<label translate>email</label>
<input type="email" class="form-control" placeholder="{{ 'email' | translate }}" ng-model="formdata.email"/>
<input type="email" class="form-control" placeholder="{{ 'email' | translate }}" required required ng-model="formdata.email"/>
</div>
<fieldset>
<label translate>password</label>
<span class="color_red text_sm pull-right" ng-show="formdata.password != formdata.password_confirm" translate>password_match</span>
<span class="color_red text_sm pull-right" ng-show="formdata.password.length < minlength" translate>password_short</span>
<div class="form-group">
<input type="password" class="form-control" id="signin_password1" placeholder="{{ 'password_type' | translate }}"/>
<input type="password" class="form-control" id="signin_password1" placeholder="{{ 'password_type' | translate }}" required ng-model="formdata.password"/>
</div>
<div class="form-group">
<input type="password" class="form-control" id="signin_password2" placeholder="{{ 'password_confirm' | translate }}"/>
<input type="password" class="form-control" id="signin_password2" placeholder="{{ 'password_confirm' | translate }}" required ng-model="formdata.password_confirm"/>
</div>
</fieldset>
<div class="form-group">
......@@ -164,7 +186,7 @@
<button class="btn btn-default" ng-click="slide.leftTo('accounts')">&lt;&lt; {{ 'back' | translate }} </button>
</div>
<div class="col-md-4">
<button class="btn btn-primary float-right" ng-click="slide.rightTo('confirmation')">{{ 'create_account' | translate }} &gt;&gt; </button>
<button type="submit" class="btn btn-primary" ng-disabled="signupForm.$invalid" ng-click="slide.rightTo('confirmation')">{{ 'create_account' | translate }} &gt;&gt; </button>
</div>
</div>
</div>
......@@ -182,16 +204,16 @@
<div class="form-group col-md-4" id="tutor_form">
<div class="form-group">
<label translate>email</label>
<input type="email" class="form-control" placeholder="{{ 'email' | translate }}" ng-model="formdata.office.email"/>
<input type="email" class="form-control" placeholder="{{ 'email' | translate }}" required ng-model="formdata.office.email"/>
</div>
<fieldset>
<label translate>password</label>
<span class="color_red text_sm pull-right" ng-show="formdata.password != formdata.password_confirm" translate>password_match</span>
<div class="form-group">
<input type="password" class="form-control" id="signin_password1" placeholder="{{ 'password_type' | translate }}"/>
<input type="password" class="form-control" id="signin_password1" placeholder="{{ 'password_type' | translate }}" required ng-model="formdata.password"/>
</div>
<div class="form-group">
<input type="password" class="form-control" id="signin_password2" placeholder="{{ 'password_confirm' | translate }}"/>
<input type="password" class="form-control" id="signin_password2" placeholder="{{ 'password_confirm' | translate }}" required ng-model="formdata.password_confirm"/>
</div>
</fieldset>
<div class="form-group">
......@@ -209,7 +231,7 @@
<button class="btn btn-default" ng-click="slide.leftTo('accounts')">&lt;&lt; {{ 'back' | translate }} </button>
</div>
<div class="col-md-4">
<button class="btn btn-primary float-right" ng-click="slide.rightTo('confirmation'); formdata.role = 'therapist'">{{ 'create_account' | translate }} &gt;&gt; </button>
<button type="submit" class="btn btn-primary" ng-disabled="signupForm.$invalid" ng-click="slide.rightTo('confirmation')">{{ 'create_account' | translate }} &gt;&gt; </button>
</div>
</div>
</div>
......@@ -224,24 +246,22 @@
<img src="img/office.jpg" alt="{{'office_center' | translate}}" title="{{'office_center' | translate}}" />
</div>
<div class="form-group col-md-4" id="office_form">
<input type="hidden" ng-model="formdata.role" value="office"></input>
<div class="form-group">
<label translate>office_name</label>
<input type="text" class="form-control" placeholder="{{ 'office_name' | translate }}" ng-model="formdata.office.name"/>
<label translate>name</label>
<input type="text" class="form-control" placeholder="{{ 'name' | translate }}" required ng-model="formdata.name"/>
</div>
<div class="form-group">
<label translate>email</label>
<input type="email" class="form-control" placeholder="{{ 'email' | translate }}" ng-model="formdata.office.email"/>
<input type="email" class="form-control" placeholder="{{ 'email' | translate }}" required ng-model="formdata.email"/>
</div>
<fieldset>
<label translate>password</label>
<span class="color_red text_sm pull-right" ng-show="formdata.password != formdata.password_confirm" translate>password_match</span>
<div class="form-group">
<input type="password" class="form-control" id="signin_password1" placeholder="{{ 'password_type' | translate }}"/>
<input type="password" class="form-control" id="signin_password1" placeholder="{{ 'password_type' | translate }}" required ng-model="formdata.password"/>
</div>
<div class="form-group">
<input type="password" class="form-control" id="signin_password2" placeholder="{{ 'password_confirm' | translate }}"/>
<input type="password" class="form-control" id="signin_password2" placeholder="{{ 'password_confirm' | translate }}" required ng-model="formdata.password_confirm"/>
</div>
</fieldset>
<div class="form-group">
......@@ -259,11 +279,12 @@
<button class="btn btn-default" ng-click="slide.leftTo('accounts')">&lt;&lt; {{ 'back' | translate }} </button>
</div>
<div class="col-md-4">
<button class="btn btn-primary float-right" ng-click="slide.rightTo('confirmation')">{{ 'create_account' | translate }} &gt;&gt; </button>
<button type="submit" class="btn btn-primary" ng-disabled="signupForm.$invalid" ng-click="slide.rightTo('confirmation')">{{ 'create_account' | translate }} &gt;&gt; </button>
</div>
</div>
</div>
</form>
<!--
SLIDE 6: Confirmation message
......@@ -277,12 +298,6 @@
</div>
<!--
SLIDE 7: Change password
-->
<div ng-class="slide.back ? 'switch-animation-back' : 'switch-animation'" ng-switch-when="change_password">
</div>
</div>
</div>
<div class="col-md-2">
......
......@@ -1103,6 +1103,12 @@ input.editable.scene-name {
float: right;
}
/* Cambiar tamaño imagen */
.small-img {
margin-top: 25px;
width: 200px;
}
/* Estilos para ngSwitch */
.switch-panel-body {
position:relative;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment