Merge branch 'master' of github.com:RocketChat/Rocket.Chat

# Via Marcelo Schmidt (2) and Gabriel Engel (1)
* 'master' of github.com:RocketChat/Rocket.Chat:
  Send e-mail on first username set
  Add enrollment email
pull/1382/head^2
Marcelo Schmidt 10 years ago
commit 152aabd035
  1. 2
      client/views/admin/admin.html
  2. 2
      i18n/en.i18n.json
  3. 4
      packages/rocketchat-lib/server/functions/setUsername.coffee
  4. 1
      packages/rocketchat-lib/settings/server/startup.coffee
  5. 11
      server/lib/accounts.coffee

@ -55,7 +55,7 @@
{{/if}}
{{#if description}}
<div>
<small class="settings-description">{{description}}</small>
<small class="settings-description">{{{description}}}</small>
</div>
{{/if}}
</div>

@ -45,6 +45,8 @@
"Accounts_OAuth_Twitter_secret" : "Twitter Secret",
"Accounts_RegistrationRequired" : "Registration Required",
"Accounts_RequireNameForSignUp" : "Require name for signup",
"Accounts_Enrollment_Email": "Enrollment E-mail",
"Accounts_Enrollment_Email_Description": "You may use [name], [fname], [lname] for the user's full name, first name or last name, respectively.<br />You may use [email] for the user's e-mail.",
"Activate" : "Activate",
"Add_custom_oauth" : "Add custom oauth",
"Add_Members" : "Add Members",

@ -16,6 +16,10 @@ RocketChat.setUsername = (user, username) ->
previousUsername = user.username
# If first time setting username, send Enrollment Email
if not previousUsername and RocketChat.settings.get 'Accounts_Enrollment_Email'
Accounts.sendEnrollmentEmail(user._id)
# Username is available; if coming from old username, update all references
if previousUsername
RocketChat.models.Messages.updateAllUsernamesByUserId user._id, username

@ -68,6 +68,7 @@ RocketChat.settings.add 'From_Email', '', { type: 'string', group: 'SMTP', place
RocketChat.settings.add 'Invitation_Subject', 'You have been invited to Rocket.Chat', { type: 'string', group: 'SMTP', section: 'Invitation' }
RocketChat.settings.add 'Invitation_HTML', '<h2>You have been invited to <h1>Rocket.Chat</h1></h2><p>Go to ' + __meteor_runtime_config__?.ROOT_URL + ' and try the best open source chat solution available today!</p>', { type: 'string', multiline: true, group: 'SMTP', section: 'Invitation' }
RocketChat.settings.add 'Accounts_Enrollment_Email', '', { type: 'string', multiline: true, group: 'SMTP', section: 'Invitation' }
RocketChat.settings.addGroup 'Message'
RocketChat.settings.add 'Message_AllowEditing', true, { type: 'boolean', group: 'Message', public: true }

@ -27,6 +27,17 @@ Accounts.emailTemplates.resetPassword.text = (user, url) ->
url = url.replace Meteor.absoluteUrl(), Meteor.absoluteUrl() + 'login/'
verifyEmailText user, url
if RocketChat.settings.get 'Accounts_Enrollment_Email'
Accounts.emailTemplates.enrollAccount.text = (user, url) ->
text = RocketChat.settings.get 'Accounts_Enrollment_Email'
text = text.replace /\[name\]/g, user.name or ''
text = text.replace /\[fname\]/g, _.strLeft(user.name, ' ') or ''
text = text.replace /\[lname\]/g, _.strRightBack(user.name, ' ') or ''
text = text.replace /\[email\]/g, user.emails?[0]?.address or ''
return text
Accounts.onCreateUser (options, user) ->
# console.log 'onCreateUser ->',JSON.stringify arguments, null, ' '
# console.log 'options ->',JSON.stringify options, null, ' '

Loading…
Cancel
Save