From 1d6118d65324cd7dd2984ac70319781439f8367b Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Mon, 25 Oct 2021 09:35:38 +0200 Subject: [PATCH] Add documentation for accounts-passwordless --- LABELS.md | 2 +- docs/_config.yml | 1 + docs/source/packages/accounts-passwordless.md | 20 +++++++++++++++++++ .../passwordless_client.js | 6 +++--- .../passwordless_server.js | 2 +- 5 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 docs/source/packages/accounts-passwordless.md diff --git a/LABELS.md b/LABELS.md index 4a5c16f55ef..9bbe88ae4a9 100644 --- a/LABELS.md +++ b/LABELS.md @@ -2,7 +2,7 @@ Labels are used to organize our issues and PRs. -We should change the labels of issues and PRs when its status changes. +We should change the labels of issues and PRs when their status changes. ### Status Labels Labels to indicate the status of a specific issue or PR. These are the most important labels as they tell us in which stage a specific item is at the moment at a glance. diff --git a/docs/_config.yml b/docs/_config.yml index 35381bd57f9..704e93e54ae 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -55,6 +55,7 @@ sidebar_categories: - api/environment Packages: - packages/accounts-ui + - packages/accounts-passwordless - packages/appcache - packages/audit-argument-checks - packages/autoupdate diff --git a/docs/source/packages/accounts-passwordless.md b/docs/source/packages/accounts-passwordless.md new file mode 100644 index 00000000000..aa8552390db --- /dev/null +++ b/docs/source/packages/accounts-passwordless.md @@ -0,0 +1,20 @@ +--- +title: accounts-passwordless +description: Documentation of Meteor's `accounts-passwordless` package. +--- + +Passwordless package allows you to create a login for users without the need for user to provide password. Upon registering or login an email is sent to the user's email with a code to enter to confirm login and a link to login directly. + +{% apibox "Meteor.loginWithToken" %} +{% apibox "Accounts.requestLoginTokenForUser" %} +{% apibox "Accounts.sendLoginTokenEmail" %} + +### E-mail templates + +`accounts-passwordless` brings new templates that you can edit to change the look of emails which send code to users. The email template is named `sendLoginToken` and beside `user` and `url`, the templates also receive a data object with `sequence` which is the user's code. + +```javascript +sendLoginToken: { + text: (user, url, { sequence }) => { /* text template */ } +} +``` diff --git a/packages/accounts-passwordless/passwordless_client.js b/packages/accounts-passwordless/passwordless_client.js index 81888e133d5..0bbebfe0d21 100644 --- a/packages/accounts-passwordless/passwordless_client.js +++ b/packages/accounts-passwordless/passwordless_client.js @@ -62,12 +62,12 @@ Meteor.loginWithToken = (selector, token, callback) => { /** * @summary Request a login token. * @locus Client - * @param selector - * @param userData + * @param {Object} selector + * @param {Object} userData * @param {Object} options * @param {String} options.selector The email address to get a token for or username or a mongo selector. * @param {String} options.userData When creating an user use this data if selector produces no result - * @param {String} options.options. For example userCreationDisabled. + * @param {String} options.options For example userCreationDisabled. * @param {Function} [callback] Optional callback. Called with no arguments on success, or with a single `Error` argument on failure. */ Accounts.requestLoginTokenForUser = ( diff --git a/packages/accounts-passwordless/passwordless_server.js b/packages/accounts-passwordless/passwordless_server.js index a62ba148f90..7c2f965c9da 100644 --- a/packages/accounts-passwordless/passwordless_server.js +++ b/packages/accounts-passwordless/passwordless_server.js @@ -210,7 +210,7 @@ Meteor.methods({ * @locus Server * @param {String} userId The id of the user to send email to. * @param {String} sequence The token to be provided - * @param {String} email. Which address of the user's to send the email to. + * @param {String} email Which address of the user's to send the email to. * @param {Object} [extra] Optional. Extra properties * @returns {Object} Object with {email, user, token, url, options} values. */