mirror of
https://github.com/meteor/meteor.git
synced 2026-01-11 00:28:02 -05:00
passwordless - improve bug fixes
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
const greet = welcomeMsg => (user, url) => {
|
||||
const greeting = (user.profile && user.profile.name) ?
|
||||
(`Hello ${user.profile.name},`) : "Hello,";
|
||||
return `${greeting}
|
||||
const greeting =
|
||||
user.profile && user.profile.name
|
||||
? `Hello ${user.profile.name},`
|
||||
: 'Hello,';
|
||||
return `${greeting}
|
||||
|
||||
${welcomeMsg}, simply click the link below.
|
||||
|
||||
${url}
|
||||
|
||||
Thanks.
|
||||
Thank you.
|
||||
`;
|
||||
};
|
||||
|
||||
@@ -17,19 +19,25 @@ Thanks.
|
||||
* @importFromPackage accounts-base
|
||||
*/
|
||||
Accounts.emailTemplates = {
|
||||
from: "Accounts Example <no-reply@example.com>",
|
||||
siteName: Meteor.absoluteUrl().replace(/^https?:\/\//, '').replace(/\/$/, ''),
|
||||
...(Accounts.emailTemplates || {}),
|
||||
from: 'Accounts Example <no-reply@example.com>',
|
||||
siteName: Meteor.absoluteUrl()
|
||||
.replace(/^https?:\/\//, '')
|
||||
.replace(/\/$/, ''),
|
||||
|
||||
resetPassword: {
|
||||
subject: () => `How to reset your password on ${Accounts.emailTemplates.siteName}`,
|
||||
text: greet("To reset your password"),
|
||||
subject: () =>
|
||||
`How to reset your password on ${Accounts.emailTemplates.siteName}`,
|
||||
text: greet('To reset your password'),
|
||||
},
|
||||
verifyEmail: {
|
||||
subject: () => `How to verify email address on ${Accounts.emailTemplates.siteName}`,
|
||||
text: greet("To verify your account email"),
|
||||
subject: () =>
|
||||
`How to verify email address on ${Accounts.emailTemplates.siteName}`,
|
||||
text: greet('To verify your account email'),
|
||||
},
|
||||
enrollAccount: {
|
||||
subject: () => `An account has been created for you on ${Accounts.emailTemplates.siteName}`,
|
||||
text: greet("To start using the service"),
|
||||
subject: () =>
|
||||
`An account has been created for you on ${Accounts.emailTemplates.siteName}`,
|
||||
text: greet('To start using the service'),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
// Accounts.emailTemplates need to be in Meteor.startup or they will be undefined nad what is added here will be overridden
|
||||
// once they get instantiated.
|
||||
Meteor.startup(() => {
|
||||
/**
|
||||
* @summary Options to customize emails sent from the Accounts system.
|
||||
* @locus Server
|
||||
* @importFromPackage accounts-base
|
||||
*/
|
||||
Accounts.emailTemplates = {
|
||||
...(Accounts.emailTemplates || {}),
|
||||
sendLoginToken: {
|
||||
subject: () => `Your login token for ${Accounts.emailTemplates.siteName}`,
|
||||
text: (user, url, { sequence }) => {
|
||||
return `Hello!
|
||||
/**
|
||||
* @summary Options to customize emails sent from the Accounts system.
|
||||
* @locus Server
|
||||
* @importFromPackage accounts-base
|
||||
*/
|
||||
Accounts.emailTemplates = {
|
||||
...(Accounts.emailTemplates || {}),
|
||||
sendLoginToken: {
|
||||
subject: () => `Your login token for ${Accounts.emailTemplates.siteName}`,
|
||||
text: (user, url, { sequence }) => {
|
||||
return `Hello!
|
||||
|
||||
Type the following token in our login form to get logged in:
|
||||
${sequence}
|
||||
@@ -20,9 +17,9 @@ ${url}
|
||||
|
||||
Thank you!
|
||||
`;
|
||||
},
|
||||
html: (user, url, { sequence }) => {
|
||||
return `Hello!<br/>
|
||||
},
|
||||
html: (user, url, { sequence }) => {
|
||||
return `Hello!<br/>
|
||||
|
||||
Type the following token in our login form to get logged in:<br/><br/>
|
||||
${sequence}<br/><br/>
|
||||
@@ -31,7 +28,6 @@ ${url}<br/>
|
||||
|
||||
Thank you!
|
||||
`;
|
||||
},
|
||||
},
|
||||
};
|
||||
})
|
||||
},
|
||||
};
|
||||
|
||||
@@ -123,4 +123,4 @@ Accounts.autoLoginWithToken = function() {
|
||||
};
|
||||
|
||||
// Run check for login token on page load
|
||||
document.addEventListener('DOMContentLoaded', () => Accounts.autoLoginWithToken())
|
||||
Meteor.startup(() => Accounts.autoLoginWithToken());
|
||||
|
||||
Reference in New Issue
Block a user