- Added error message for invalid reason

- Added method to save reason into user object
- Added validation to display field but setting Accounts_ManuallyApproveNewUsers is not working :(
pull/7098/head
Luis Fernando do Nascimento 9 years ago
parent b9f983a1b5
commit dbcba5634b
  1. 1
      packages/rocketchat-i18n/i18n/en.i18n.json
  2. 10
      packages/rocketchat-lib/server/models/Users.js
  3. 7
      packages/rocketchat-ui-login/client/login/form.js
  4. 2
      server/methods/registerUser.js

@ -764,6 +764,7 @@
"Invalid_name": "The name must not be empty",
"Invalid_notification_setting_s": "Invalid notification setting: %s",
"Invalid_pass": "The password must not be empty",
"Invalid_reason": "The reason to join must not be empty",
"Invalid_room_name": "<strong>%s</strong> is not a valid room name,<br/> use only letters, numbers, hyphens and underscores",
"Invalid_secret_URL_message": "The URL provided is invalid.",
"Invalid_setting_s": "Invalid setting: %s",

@ -313,6 +313,16 @@ class ModelUsers extends RocketChat.models._Base {
return this.update(_id, update);
}
setReason(_id, reason) {
const update = {
$set: {
reason
}
};
return this.update(_id, update);
}
setCustomFields(_id, fields) {
const values = {};
Object.keys(fields).reduce(key => {

@ -60,7 +60,9 @@ Template.loginForm.helpers({
return typeof OnePassword !== 'undefined' && OnePassword.findLoginForUrl && typeof device !== 'undefined' && device.platform && device.platform.toLocaleLowerCase() === 'ios';
},
manuallyApproveNewUsers() {
return RocketChat.settings.get('Accounts_ManuallyApproveNewUsers');
//TODO verify why it' s not getting this setting
//return RocketChat.settings.get('Accounts_ManuallyApproveNewUsers');
return true;
}
});
@ -253,6 +255,9 @@ Template.loginForm.onCreated(function() {
if (RocketChat.settings.get('Accounts_RequirePasswordConfirmation') && formObj['confirm-pass'] !== formObj['pass']) {
validationObj['confirm-pass'] = t('Invalid_confirm_pass');
}
if (true && !formObj['reason']) {
validationObj['reason'] = t('Invalid_reason');
}
validateCustomFields(formObj, validationObj);
}
$('#login-card h2').removeClass('error');

@ -17,6 +17,7 @@ Meteor.methods({
email: String,
pass: String,
name: String,
reason: String,
secretURL: Match.Optional(String)
}));
}
@ -45,6 +46,7 @@ Meteor.methods({
}
RocketChat.models.Users.setName(userId, s.trim(formData.name));
RocketChat.models.Users.setReason(userId, s.trim(formData.reason));
RocketChat.saveCustomFields(userId, formData);

Loading…
Cancel
Save