From 842938bccb81c7de1ee6e6590103127b3d5a8a42 Mon Sep 17 00:00:00 2001 From: Steve Hobbs Date: Mon, 11 Sep 2023 14:20:15 +0100 Subject: [PATCH] chore: document 'captcha' param for login and signupAndLogin (#1322) --- src/web-auth/index.js | 14 ++++++-------- src/web-auth/redirect.js | 7 ++++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/web-auth/index.js b/src/web-auth/index.js index c460a05b..60e259b8 100644 --- a/src/web-auth/index.js +++ b/src/web-auth/index.js @@ -416,10 +416,7 @@ WebAuth.prototype.validateAuthenticationResponse = function ( ); } - if ( - payload.org_name !== - transactionOrganization.toLowerCase() - ) { + if (payload.org_name !== transactionOrganization.toLowerCase()) { return callback( error.invalidToken( 'Organization Name (org_name) claim value mismatch in the ID token; expected "' + @@ -921,6 +918,7 @@ WebAuth.prototype.signupAndAuthorize = function (options, cb) { * @param {String} [options.email] Email (mutually exclusive with username) * @param {String} [options.password] Password * @param {String} [options.realm] Realm used to authenticate the user, it can be a realm name or a database connection name + * @param {String} [options.captcha] the attempted solution for the captcha, if one was presented * @param {onRedirectingCallback} [options.onRedirecting] Hook function that is called before redirecting to /authorize, allowing you to handle custom code. You must call the `done` function to resume authentication. * @param {crossOriginLoginCallback} cb Callback function called only when an authentication error, like invalid username or password, occurs. For other types of errors, there will be a redirect to the `redirectUri`. * @memberof WebAuth.prototype @@ -1142,8 +1140,8 @@ WebAuth.prototype.passwordlessVerify = function (options, cb) { * @param {Function} [options.templates.auth0] template function receiving the challenge and returning a string * @param {Function} [options.templates.recaptcha_v2] template function receiving the challenge and returning a string * @param {Function} [options.templates.recaptcha_enterprise] template function receiving the challenge and returning a string - * @param {Function} [options.templates.hcaptcha] template function receiving the challenge and returning a string - * @param {Function} [options.templates.friendly_captcha] template function receiving the challenge and returning a string + * @param {Function} [options.templates.hcaptcha] template function receiving the challenge and returning a string + * @param {Function} [options.templates.friendly_captcha] template function receiving the challenge and returning a string * @param {Function} [options.templates.error] template function returning a custom error message when the challenge could not be fetched, receives the error as first argument * @param {String} [options.lang=en] the ISO code of the language for the captcha provider * @param {Function} [callback] An optional completion callback @@ -1165,8 +1163,8 @@ WebAuth.prototype.renderCaptcha = function (element, options, callback) { * @param {Function} [options.templates.auth0] template function receiving the challenge and returning a string * @param {Function} [options.templates.recaptcha_v2] template function receiving the challenge and returning a string * @param {Function} [options.templates.recaptcha_enterprise] template function receiving the challenge and returning a string - * @param {Function} [options.templates.hcaptcha] template function receiving the challenge and returning a string - * @param {Function} [options.templates.friendly_captcha] template function receiving the challenge and returning a string + * @param {Function} [options.templates.hcaptcha] template function receiving the challenge and returning a string + * @param {Function} [options.templates.friendly_captcha] template function receiving the challenge and returning a string * @param {Function} [options.templates.error] template function returning a custom error message when the challenge could not be fetched, receives the error as first argument * @param {String} [options.lang=en] the ISO code of the language for the captcha provider * @param {Function} [callback] An optional completion callback diff --git a/src/web-auth/redirect.js b/src/web-auth/redirect.js index 6fc88e97..e24af0f3 100644 --- a/src/web-auth/redirect.js +++ b/src/web-auth/redirect.js @@ -35,7 +35,7 @@ function Redirect(auth0, options) { * @memberof Redirect.prototype * @memberof Redirect.prototype */ -Redirect.prototype.loginWithCredentials = function(options, cb) { +Redirect.prototype.loginWithCredentials = function (options, cb) { options.realm = options.realm || options.connection; delete options.connection; this.crossOriginAuthentication.login(options, cb); @@ -49,13 +49,14 @@ Redirect.prototype.loginWithCredentials = function(options, cb) { * @param {String} options.email user email address * @param {String} options.password user password * @param {String} options.connection name of the connection where the user will be created + * @param {String} [options.captcha] the attempted solution for the captcha, if one was presented * @param {crossOriginLoginCallback} cb * @memberof Redirect.prototype */ -Redirect.prototype.signupAndLogin = function(options, cb) { +Redirect.prototype.signupAndLogin = function (options, cb) { var _this = this; - return this.webAuth.client.dbConnection.signup(options, function(err) { + return this.webAuth.client.dbConnection.signup(options, function (err) { if (err) { return cb(err); }