updated Ansible scripts to install postfix

parent b1534f95
......@@ -6,6 +6,11 @@
state: present
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Amazon'
- name: Install Postfix (for sending emails)
package:
name: postfix
state: present
- name: Install NPM dependencies
npm:
path: "{{ server_path }}/{{ server_relative_path }}"
......
......@@ -4,6 +4,7 @@ const fs = require('fs');
const path = require('path');
const lodash = require('lodash');
const bcrypt = require('bcrypt-nodejs');
const generatePassword = require('password-generator');
/**
* SupervisorController
......@@ -272,7 +273,7 @@ module.exports = {
var params = req.params.all();
// Send email confirmation --------------------------------
function sendConfirmationMail(supervisor, cb) {
function sendConfirmationMail(supervisor, password, cb) {
var token = sailsTokenAuth.issueToken({
id_sup: supervisor.id,
......@@ -282,7 +283,11 @@ module.exports = {
var message = sails.__({
phrase: 'signin_mail',
locale: params.lang || 'es-es'
}) + 'https://' + req.headers.host + '/sup/activate/' + token; // expires in 1 week
},
{
url: 'https://' + req.headers.host + '/sup/activate/' + token,
password: password
});
var subject = sails.__({
phrase: 'notification_from_pictogram',
......@@ -303,13 +308,17 @@ module.exports = {
sails.log.debug("Creating supervisor with params " + JSON.stringify(params));
if (!params.password || !params.email )
if (!params.name || !params.surname || !params.email )
return res.badRequest("Invalid params");
// randomly generated memorable password
var password = generatePassword();
var supData = {
role: params.role,
name: typeof params.name == 'undefined' ? '' : params.name,
password: params.password,
name: params.name,
surname: params.surname,
password: password,
email: params.email,
pic: sails.config.pictogram.paths.defaultAvatarFileName,
lang: params.lang || 'es-es',
......@@ -321,7 +330,7 @@ module.exports = {
if (!sup)
return res.serverError("Supervisor created but returned null");
sendConfirmationMail(sup, (err) => {
sendConfirmationMail(sup, password, (err) => {
if (err) throw err;
return res.ok();
});
......
......@@ -246,6 +246,7 @@
"msg_change_password": "Please enter a new password for your account:",
"msg_request_change_password": "Enter your email to request for a password change. An e-mail will be sent to access password change form.",
"name": "Name",
"name_invalid": "Invalid name",
"new_img": "New image",
"new_instruction": "New instruction",
"new_method": "New method",
......@@ -266,7 +267,7 @@
"no_office": "No office",
"no_subscribed": "No connection to student account",
"no_students": "You are not linked to any student",
"no_students_desc": "Click on 'Add student' to link to existing student accounts or to create new ones",
"no_students_desc": "Click on 'Add student' to link to existing student accounts or to create new ones",
"no_students_for_user": "You are not associated to any students. Please ask your office to link your account to a Pictogram student.",
"no_space_in_category": "No space left in category",
"no_supervisors": "No supervisors linked. ",
......@@ -435,6 +436,7 @@
"supervisors": "Supervisors",
"support": "User support",
"surname": "Surname",
"surname_invalid": "Invalid surname",
"tag_deleted": "Tag deleted",
"tape_background": "Tape background",
"template_deleted": "Template deleted",
......
......@@ -245,6 +245,7 @@
"msg_change_password": "Por favor, introduzca la nueva clave para su cuenta:",
"msg_request_change_password": "Introduzca su correo electrónico para solicitar el cambio de clave. Recibirá un correo con la dirección de acceso al formulario de cambio de clave.",
"name": "Nombre",
"name_invalid": "Nombre inválido",
"new_img": "Nueva imagen",
"new_instruction": "Nueva instrucción",
"new_method": "Nuevo método",
......@@ -433,6 +434,7 @@
"support": "Atención al cliente",
"supervisors": "Supervisores",
"surname": "Apellidos",
"surname_invalid": "Apellidos inválidos",
"tag_deleted": "Etiqueta borrada",
"tape_background": "Fondo de la cinta",
"template_deleted": "Plantilla eliminada",
......
......@@ -100,15 +100,12 @@ function LoginCtrl(
var formdata_empty = {
name: '',
surname: '',
email: '',
password: '',
password_confirm: '',
lang: '',
role: '',
};
$scope.minlength = CONSTANTS.password_minlength;
/* Forms objects */
$scope.forms = {};
......@@ -142,13 +139,13 @@ $scope.signup = function (formName) {
return;
}
if ($scope.formdata.password.length < CONSTANTS.password_minlength) {
ngToast.danger($translate.instant('password_short', {minlength: CONSTANTS.password_minlength}));
if (typeof $scope.formdata.name == 'undefined' || form.name.$invalid) {
ngToast.danger($translate.instant('name_invalid'));
return;
}
if ($scope.formdata.password !== $scope.formdata.password_confirm) {
ngToast.danger($translate.instant('password_match'));
if (typeof $scope.formdata.surname == 'undefined' || form.surname.$invalid) {
ngToast.danger($translate.instant('surname_invalid'));
return;
}
......
......@@ -154,23 +154,20 @@
<div class="form-group col-md-4">
<input type="hidden" ng-model="formdata.role" value="tutor"></input>
<div class="form-group">
<label translate>email</label>
<label translate>name</label>
<div class="form-group">
<input type="email" class="form-control" name="email" placeholder="{{ 'email' | translate }}" ng-model="formdata.email"/>
<span class="color_red text_sm pull-right" ng-show="forms.tutorForm.email.$dirty && forms.tutorForm.email.$invalid" translate>email_invalid</span>
<input type="text" class="form-control" name="name" placeholder="{{ 'name' | translate }}" ng-model="formdata.name" required/>
</div>
</div>
<fieldset>
<label translate>password</label>
<div class="form-group">
<input type="password" class="form-control" id="signin_password1" placeholder="{{ 'password_type' | translate }}" name="password" required ng-model="formdata.password"/>
<span class="color_red text_sm pull-right" ng-show="formdata.password.length < minlength && forms.tutorForm.password.$dirty && forms.tutorForm.password_confirm.$dirty"> {{ 'password_short' | translate:'{ minlength: minlength }' }}</span>
</div>
<div class="form-group">
<input type="password" class="form-control" id="signin_password2" placeholder="{{ 'password_confirm' | translate }}" name="password_confirm" required ng-model="formdata.password_confirm"/>
<span class="color_red text_sm pull-right" ng-show="formdata.password != formdata.password_confirm && forms.tutorForm.password.$dirty && forms.tutorForm.password_confirm.$dirty" translate>password_match</span>
</div>
</fieldset>
<label translate>surname</label>
<div class="form-group">
<input type="text" class="form-control" name="surname" placeholder="{{ 'surname' | translate }}" ng-model="formdata.surname" required/>
</div>
<label translate>email</label>
<div class="form-group">
<input type="email" class="form-control" name="email" placeholder="{{ 'email' | translate }}" ng-model="formdata.email"/>
<span class="color_red text_sm pull-right" ng-show="forms.tutorForm.email.$dirty && forms.tutorForm.email.$invalid" translate>email_invalid</span>
</div>
<div class="form-group">
<input type="checkbox" ng-model="formdata.disclaimer_accepted">
<span translate>disclaimer_accept</span>
......
......@@ -6,7 +6,7 @@
"no_name": "No name",
"no_surname": "No surname",
"office_link": "The office/center \"{{ name }}\" with email \"{{ email }}\" has added you as part of its team in Pictogram.",
"signin_mail": "To activate your Pictogram account, click on this link:\n",
"signin_mail": "To activate your Pictogram account, first click on this link:\n {{ url }} \nAccess with your email and the following password:\n {{ password }}\nWe recommend to change your password as soon as possible.",
"student_unlinked": "You have lost the link to the student \"{{ name }} {{ surname }}\", with license number \"{{ license }}\".",
"therapist_office_request": "{{ name }}, with email {{ email }}, is requesting to be linked as therapist to any of your students.",
"tutor_office_request": "{{ name }}, with email {{ email }}, is requesting to be linked as tutor/father/mother to any of your students.",
......
......@@ -6,7 +6,7 @@
"no_name": "Sin nombre",
"no_surname": "Sin apellidos",
"office_link": "El centro/gabinete \"{{ name }}\", con correo electrónico \"{{ email }}\" le ha añadido como parte de su equipo.",
"signin_mail": "Para activar su cuenta en Pictogram, haga click en el siguiente enlace:\n",
"signin_mail": "Para activar su cuenta en Pictogram, primero haga click en el siguiente enlace:\n {{ url }} \nAcceda con su correo y la contraseña siguiente:\n {{ password }}\nLe recomendamos modificar la contraseña tan pronto accede al sistema.",
"student_unlinked": "Se ha desvinculado de la cuenta de estudiante \"{{ name }} {{ surname }}\", con número de licencia \"{{ license }}\".",
"therapist_office_request": "El/la terapeuta {{ name }}, con correo electrónico {{ email }}, pide ser asociado a algún estudiante.",
"tutor_office_request": "El/la tutor/a/padre/madre {{ name }}, con correo electrónico {{ email }}, pide ser asociado a algún estudiante.",
......
......@@ -22,6 +22,7 @@
"include-all": "~0.1.3",
"jsonwebtoken": "~0.4.0",
"lodash": "^3.10.1",
"password-generator": "^2.1.0",
"rc": "~0.5.0",
"sails": "^0.12.3",
"sails-disk": "~0.10.0",
......
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