meteor-useraccounts / core

Meteor sign up and sign in templates' core functionalities
http://useraccounts.meteor.com/
MIT License
529 stars 281 forks source link

Add customization and language support for emails #566

Open etorres opened 8 years ago

etorres commented 8 years ago

This is more a question than an issue. My application is deployed locally on port 4000 and a HTTP proxy is used to redirect the traffic to the port 80. How can I do to include the server's URL in the verification email? Currently the verification link is as follows (note the localhost and the internal port):

http://localhost:4000/#/verify-email/LP60alU-VTIHEkN1hojilOaZm2jhJ2ep5yVWI1zKdsc

Secondly, message body is always in english, despite the rest of the text is in the language configured with T9n.

Thanks in advance!

splendido commented 8 years ago

The i18 for email texts is a good point!

...for the verification link, I think you should set ROOT_URL env variable to your front address. See here for an explanation.

the weird think actually is you get a # within the address!

  1. are you configuring the AT routes with AccountsTemplates.configureRoute?
  2. are you making the very same calls on both the client and the server (which is, is your configuration files for the routes inside a shared folder?)?
etorres commented 8 years ago

Hi and many thanks for your response. Regarding the use of ROOT_URL, I will check how to properly setup this environment variable in production. Since we're deploying meteor behind a proxy to distribute the workload among several servers, a configuration option would be desirable in order to set the URL of the proxy instead of the URL of the servers behind the proxy. In this way, all emails will link to the proxy regardless of where the mail was originated (which server actually sent the email).

Regarding AccountsTemplates configuration, I created the file lib/config/at_config.js, and I put the following code inside the file:

AccountsTemplates.configure({
  // Behavior
  confirmPassword: true,
  enablePasswordChange: true,
  forbidClientAccountCreation: false,
  overrideLoginErrors: true,
  sendVerificationEmail: true,
  lowercaseUsername: false,
  focusFirstInput: true,
  // TODO showReCaptcha: CheckMode.isProduction(),

  // Appearance
  defaultLayout: 'fullPageLayout',
  showAddRemoveServices: false,
  showForgotPasswordLink: true,
  showLabels: true,
  showPlaceholders: true,
  showResendVerificationEmailLink: false,

  // Client-side Validation
  continuousValidation: false,
  negativeFeedback: false,
  negativeValidation: true,
  positiveValidation: true,
  positiveFeedback: true,
  showValidating: true,

  // Privacy Policy and Terms of Use
  privacyUrl: 'privacidad',
  termsUrl: 'terminos-de-uso',

  // Redirects
  homeRoutePath: '/',
  redirectTimeout: 4000,

  // Hooks
  onLogoutHook: logoutFn
});

T9n.setLanguage('es_ES');

AccountsTemplates.configureRoute('signIn', {
  name: 'Login',
  path: '/login',
  template: 'login',
  layoutTemplate: 'fullPageLayout',
  redirect: function() {
    var user = Meteor.user();
    if (user) Router.go('/usuario/' + user._id);
  }
});