diff --git a/packages/accounts-base/accounts_common.js b/packages/accounts-base/accounts_common.js index 880513be06..f83aced014 100644 --- a/packages/accounts-base/accounts_common.js +++ b/packages/accounts-base/accounts_common.js @@ -6,13 +6,13 @@ if (!Accounts._options) { } // @param options {Object} an object with fields: -// - sendConfirmationEmail {Boolean} -// Send email address confirmation emails to new users created from +// - sendVerificationEmail {Boolean} +// Send email address verification emails to new users created from // client signups. // - forbidClientAccountCreation {Boolean} // Do not allow clients to create accounts directly. Accounts.config = function(options) { - _.each(["sendConfirmationEmail", "forbidClientAccountCreation"], function(key) { + _.each(["sendVerificationEmail", "forbidClientAccountCreation"], function(key) { if (key in options) { if (key in Accounts._options) throw new Error("Can't set `" + key + "` more than once"); diff --git a/packages/accounts-base/accounts_server.js b/packages/accounts-base/accounts_server.js index 1ae98e730e..93a5e62164 100644 --- a/packages/accounts-base/accounts_server.js +++ b/packages/accounts-base/accounts_server.js @@ -260,9 +260,9 @@ return Meteor.users.find( {_id: this.userId}, {fields: {profile: 1, username: 1, - // We do let the UI know if emails are confirmed but we don't - // want to publish the confirmationTokens field! - 'emails.address': 1, 'emails.confirmed': 1}}); + // We do let the UI know if emails are verified but we don't + // want to publish the verificationTokens field! + 'emails.address': 1, 'emails.verified': 1}}); else { this.complete(); return null; diff --git a/packages/accounts-password/email_templates.js b/packages/accounts-password/email_templates.js index 2c7fbfb772..fbcca8419a 100644 --- a/packages/accounts-password/email_templates.js +++ b/packages/accounts-password/email_templates.js @@ -18,16 +18,16 @@ Accounts.emailTemplates = { + "Thanks.\n"; } }, - confirmEmail: { + verifyEmail: { subject: function(user) { - return "How to confirm your account email on " + Accounts.emailTemplates.siteName; + return "How to verify email address on " + Accounts.emailTemplates.siteName; }, text: function(user, url) { var greeting = (user.profile && user.profile.name) ? ("Hello " + user.profile.name + ",") : "Hello,"; return greeting + "\n" + "\n" - + "To confirm your account email, simply click the link below.\n" + + "To verify your account email, simply click the link below.\n" + "\n" + url + "\n" + "\n" diff --git a/packages/accounts-password/email_tests.js b/packages/accounts-password/email_tests.js index 5e0daf27a6..843e98c261 100644 --- a/packages/accounts-password/email_tests.js +++ b/packages/accounts-password/email_tests.js @@ -8,7 +8,7 @@ var email4; var resetPasswordToken; - var confirmEmailToken; + var verifyEmailToken; var enrollAccountToken; Accounts._isolateLoginTokenForTest(); @@ -29,7 +29,7 @@ function (test, expect) { Meteor.call("getInterceptedEmails", email1, expect(function (error, result) { test.notEqual(result, undefined); - test.equal(result.length, 2); // the first is the email confirmation + test.equal(result.length, 2); // the first is the email verification var content = result[1]; var match = content.match( @@ -65,7 +65,7 @@ } ]); - var getConfirmEmailToken = function (email, test, expect) { + var getVerifyEmailToken = function (email, test, expect) { Meteor.call("getInterceptedEmails", email, expect(function (error, result) { test.isFalse(error); test.notEqual(result, undefined); @@ -74,9 +74,9 @@ var match = content.match( new RegExp(window.location.protocol + "//" + - window.location.host + "/#\\/confirm-email/(\\S*)")); + window.location.host + "/#\\/verify-email/(\\S*)")); test.isTrue(match); - confirmEmailToken = match[1]; + verifyEmailToken = match[1]; })); }; @@ -95,7 +95,7 @@ }); }; - testAsyncMulti("accounts emails - confirm email flow", [ + testAsyncMulti("accounts emails - verify email flow", [ function (test, expect) { email2 = Meteor.uuid() + "-intercept@example.com"; email3 = Meteor.uuid() + "-intercept@example.com"; @@ -106,15 +106,15 @@ function (test, expect) { test.equal(Meteor.user().emails.length, 1); test.equal(Meteor.user().emails[0].address, email2); - test.isFalse(Meteor.user().emails[0].confirmed); - // We should NOT be publishing confirmation tokens! - test.isFalse(_.has(Meteor.user().emails[0], 'confirmationTokens')); + test.isFalse(Meteor.user().emails[0].verified); + // We should NOT be publishing verification tokens! + test.isFalse(_.has(Meteor.user().emails[0], 'verificationTokens')); }, function (test, expect) { - getConfirmEmailToken(email2, test, expect); + getVerifyEmailToken(email2, test, expect); }, function (test, expect) { - // Log out, to test that confirmEmail logs us back in. (And if we don't + // Log out, to test that verifyEmail logs us back in. (And if we don't // do that, waitUntilLoggedIn won't be able to prevent race conditions.) Meteor.logout(expect(function (error) { test.equal(error, undefined); @@ -122,17 +122,17 @@ })); }, function (test, expect) { - Accounts.confirmEmail(confirmEmailToken, + Accounts.verifyEmail(verifyEmailToken, waitUntilLoggedIn(test, expect)); }, function (test, expect) { test.equal(Meteor.user().emails.length, 1); test.equal(Meteor.user().emails[0].address, email2); - test.isTrue(Meteor.user().emails[0].confirmed); + test.isTrue(Meteor.user().emails[0].verified); }, function (test, expect) { Meteor.call( - "addEmailForTestAndConfirm", email3, + "addEmailForTestAndVerify", email3, expect(function (error, result) { test.isFalse(error); })); @@ -141,14 +141,14 @@ Meteor.default_connection.onQuiesce(expect(function () { test.equal(Meteor.user().emails.length, 2); test.equal(Meteor.user().emails[1].address, email3); - test.isFalse(Meteor.user().emails[1].confirmed); + test.isFalse(Meteor.user().emails[1].verified); })); }, function (test, expect) { - getConfirmEmailToken(email3, test, expect); + getVerifyEmailToken(email3, test, expect); }, function (test, expect) { - // Log out, to test that confirmEmail logs us back in. (And if we don't + // Log out, to test that verifyEmail logs us back in. (And if we don't // do that, waitUntilLoggedIn won't be able to prevent race conditions.) Meteor.logout(expect(function (error) { test.equal(error, undefined); @@ -156,12 +156,12 @@ })); }, function (test, expect) { - Accounts.confirmEmail(confirmEmailToken, + Accounts.verifyEmail(verifyEmailToken, waitUntilLoggedIn(test, expect)); }, function (test, expect) { test.equal(Meteor.user().emails[1].address, email3); - test.isTrue(Meteor.user().emails[1].confirmed); + test.isTrue(Meteor.user().emails[1].verified); }, function (test, expect) { Meteor.logout(expect(function (error) { @@ -194,7 +194,7 @@ var user = result; test.equal(user.emails.length, 1); test.equal(user.emails[0].address, email4); - test.isFalse(user.emails[0].confirmed); + test.isFalse(user.emails[0].verified); })); }, function (test, expect) { @@ -207,7 +207,7 @@ function (test, expect) { test.equal(Meteor.user().emails.length, 1); test.equal(Meteor.user().emails[0].address, email4); - test.isTrue(Meteor.user().emails[0].confirmed); + test.isTrue(Meteor.user().emails[0].verified); }, function (test, expect) { Meteor.logout(expect(function (error) { @@ -222,7 +222,7 @@ function (test, expect) { test.equal(Meteor.user().emails.length, 1); test.equal(Meteor.user().emails[0].address, email4); - test.isTrue(Meteor.user().emails[0].confirmed); + test.isTrue(Meteor.user().emails[0].verified); }, function (test, expect) { Meteor.logout(expect(function (error) { diff --git a/packages/accounts-password/email_tests_setup.js b/packages/accounts-password/email_tests_setup.js index 64486b6fa5..9684f1e47c 100644 --- a/packages/accounts-password/email_tests_setup.js +++ b/packages/accounts-password/email_tests_setup.js @@ -24,11 +24,11 @@ return interceptedEmails[email]; }, - addEmailForTestAndConfirm: function (email) { + addEmailForTestAndVerify: function (email) { Meteor.users.update( {_id: this.userId}, - {$push: {emails: {address: email, confirmed: false}}}); - Accounts.sendConfirmationEmail(this.userId, email); + {$push: {emails: {address: email, verified: false}}}); + Accounts.sendVerificationEmail(this.userId, email); }, createUserOnServer: function (email) { diff --git a/packages/accounts-password/passwords_client.js b/packages/accounts-password/passwords_client.js index ba3866df8a..00e21e0498 100644 --- a/packages/accounts-password/passwords_client.js +++ b/packages/accounts-password/passwords_client.js @@ -164,20 +164,20 @@ }); }; - // Confirms a user's email address based on a token originally - // created by Accounts.sendConfirmationEmail + // Verifies a user's email address based on a token originally + // created by Accounts.sendVerificationEmail // // @param token {String} // @param callback (optional) {Function(error|undefined)} - Accounts.confirmEmail = function(token, callback) { + Accounts.verifyEmail = function(token, callback) { if (!token) throw new Error("Need to pass token"); Meteor.call( - "confirmEmail", token, + "verifyEmail", token, function (error, result) { if (error || !result) { - error = error || new Error("No result from call to confirmUser"); + error = error || new Error("No result from call to verifyEmail"); callback && callback(error); return; } diff --git a/packages/accounts-password/passwords_server.js b/packages/accounts-password/passwords_server.js index 1a0d1b5ff7..9870e468df 100644 --- a/packages/accounts-password/passwords_server.js +++ b/packages/accounts-password/passwords_server.js @@ -126,7 +126,7 @@ Meteor.users.update({_id: user._id, 'emails.address': email}, { $set: {'services.password.srp': newVerifier, 'services.resume.loginTokens': [stampedLoginToken], - 'emails.$.confirmed': true}, + 'emails.$.verified': true}, $unset: {'services.password.reset': 1} }); @@ -134,13 +134,13 @@ return {token: stampedLoginToken.token, id: user._id}; }, - confirmEmail: function (token) { + verifyEmail: function (token) { if (!token) throw new Meteor.Error(400, "Need to pass token"); - var user = Meteor.users.findOne({'emails.confirmationTokens.token': token}); + var user = Meteor.users.findOne({'emails.verificationTokens.token': token}); if (!user) - throw new Meteor.Error(403, "Confirm email link expired"); + throw new Meteor.Error(403, "Verify email link expired"); // Log the user in with a new login token. var stampedLoginToken = Accounts._generateStampedLoginToken(); @@ -151,9 +151,9 @@ // http://www.mongodb.org/display/DOCS/Updating/#Updating-The%24positionaloperator) // http://www.mongodb.org/display/DOCS/Updating#Updating-%24pull Meteor.users.update( - {_id: user._id, 'emails.confirmationTokens.token': token}, { - $set: {'emails.$.confirmed': true}, - $pull: {'emails.$.confirmationTokens': {token: token}}, + {_id: user._id, 'emails.verificationTokens.token': token}, { + $set: {'emails.$.verified': true}, + $pull: {'emails.$.verificationTokens': {token: token}}, $push: {'services.resume.loginTokens': stampedLoginToken}}); this.setUserId(user._id); @@ -196,8 +196,8 @@ // send the user an email with a link that when opened marks that - // address as confirmed - Accounts.sendConfirmationEmail = function (userId, email) { + // address as verified + Accounts.sendVerificationEmail = function (userId, email) { // XXX Also generate a link using which someone can delete this // account if they own said address but weren't those who created // this account. @@ -206,9 +206,9 @@ var user = Meteor.users.findOne(userId); if (!user) throw new Error("Can't find user"); - // pick the first unconfirmed email if we weren't passed an email. + // pick the first unverified email if we weren't passed an email. if (!email) { - email = _.find(user.emails || [], function (e) { return !e.confirmed; }); + email = _.find(user.emails || [], function (e) { return !e.verified; }); email = (email || {}).address; } // make sure we have a valid email @@ -218,19 +218,19 @@ var stampedToken = {token: Meteor.uuid(), when: +(new Date)}; Meteor.users.update({_id: userId, 'emails.address': email}, - {$push: {'emails.$.confirmationTokens': stampedToken}}); + {$push: {'emails.$.verificationTokens': stampedToken}}); - var confirmEmailUrl = Accounts.urls.confirmEmail(stampedToken.token); + var verifyEmailUrl = Accounts.urls.verifyEmail(stampedToken.token); Email.send({ to: email, from: Accounts.emailTemplates.from, - subject: Accounts.emailTemplates.confirmEmail.subject(user), - text: Accounts.emailTemplates.confirmEmail.text(user, confirmEmailUrl) + subject: Accounts.emailTemplates.verifyEmail.subject(user), + text: Accounts.emailTemplates.verifyEmail.text(user, verifyEmailUrl) }); }; // send the user an email informing them that their account was created, with - // a link that when opened both marks their email as confirmed and forces them + // a link that when opened both marks their email as verified and forces them // to choose their password. The email must be one of the addresses in the // user's emails field, or undefined to pick the first email automatically. Accounts.sendEnrollmentEmail = function (userId, email) { @@ -383,7 +383,7 @@ if (username) user.username = username; if (email) - user.emails = [{address: email, confirmed: false}]; + user.emails = [{address: email, verified: false}]; return Accounts.insertUserDoc(options, extra, user); }; @@ -399,15 +399,15 @@ // Create user. result contains id and token. var result = createUser(options, extra); // safety belt. createUser is supposed to throw on error. send 500 error - // instead of sending a confirmation email with empty userid. + // instead of sending a verification email with empty userid. if (!result.id) throw new Error("createUser failed to insert new user"); - // If `Accounts._options.sendConfirmationEmail` is set, register - // a token to confirm the user's primary email, and send it to + // If `Accounts._options.sendVerificationEmail` is set, register + // a token to verify the user's primary email, and send it to // that address. - if (options.email && Accounts._options.sendConfirmationEmail) - Accounts.sendConfirmationEmail(result.id, options.email); + if (options.email && Accounts._options.sendVerificationEmail) + Accounts.sendVerificationEmail(result.id, options.email); // client gets logged in as the new user afterwards. this.setUserId(result.id); diff --git a/packages/accounts-password/passwords_tests_setup.js b/packages/accounts-password/passwords_tests_setup.js index 19b685a48d..bd5aa463e6 100644 --- a/packages/accounts-password/passwords_tests_setup.js +++ b/packages/accounts-password/passwords_tests_setup.js @@ -28,7 +28,7 @@ Accounts.onCreateUser(function (options, extra, user) { // For now, we just test the one configuration state. You can comment // out each configuration option and see that the tests fail. Accounts.config({ - sendConfirmationEmail: true + sendVerificationEmail: true }); diff --git a/packages/accounts-ui-unstyled/login_buttons_dialogs.html b/packages/accounts-ui-unstyled/login_buttons_dialogs.html index 29a666a432..692d28d815 100644 --- a/packages/accounts-ui-unstyled/login_buttons_dialogs.html +++ b/packages/accounts-ui-unstyled/login_buttons_dialogs.html @@ -1,7 +1,7 @@ {{> _resetPasswordDialog}} {{> _enrollAccountDialog}} - {{> _justConfirmedEmailDialog}} + {{> _justVerifiedEmailDialog}} {{> _configureLoginServiceDialog}} @@ -60,11 +60,11 @@ {{/if}} -