Skip to content

Commit

Permalink
Add APIs to get captcha challenge for reset password (#1426)
Browse files Browse the repository at this point in the history
  • Loading branch information
srijonsaha authored Apr 25, 2024
1 parent 105e67b commit 94d41dc
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 59 deletions.
25 changes: 20 additions & 5 deletions dist/auth0.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* auth0-js v9.24.1
* Author: Auth0
* Date: 2024-01-04
* Date: 2024-04-25
* License: MIT
*/

Expand Down Expand Up @@ -9528,7 +9528,7 @@
* @see {@link https://auth0.com/docs/api/authentication#signup}
* @ignore
*/
DBConnection.prototype.signup = function(options, cb) {
DBConnection.prototype.signup = function (options, cb) {
var url;
var body;
var metadata;
Expand Down Expand Up @@ -9587,7 +9587,7 @@
* @see {@link https://auth0.com/docs/api/authentication#change-password}
* @ignore
*/
DBConnection.prototype.changePassword = function(options, cb) {
DBConnection.prototype.changePassword = function (options, cb) {
var url;
var body;

Expand All @@ -9604,8 +9604,8 @@
url = urlJoin(this.baseOptions.rootUrl, 'dbconnections', 'change_password');

body = objectHelper
.merge(this.baseOptions, ['clientID'])
.with(options, ['email', 'connection']);
.merge(this.baseOptions, ['clientID', 'state'])
.with(options, ['email', 'connection', 'captcha']);

body = objectHelper.toSnakeCase(body, ['auth0Client']);

Expand All @@ -9615,6 +9615,21 @@
.end(wrapCallback(cb));
};

DBConnection.prototype.getChallenge = function (cb) {
assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });

if (!this.baseOptions.state) {
return cb();
}

var url = urlJoin(this.baseOptions.rootUrl, 'dbconnections', 'challenge');

return this.request
.post(url)
.send({ state: this.baseOptions.state })
.end(wrapCallback(cb, { ignoreCasing: true }));
};

/**
* Creates a new Auth0 Authentication API client
* @constructor
Expand Down
4 changes: 2 additions & 2 deletions dist/auth0.min.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/auth0.min.esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/auth0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/auth0.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cordova-auth0-plugin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* auth0-js v9.24.1
* Author: Auth0
* Date: 2024-01-04
* Date: 2024-04-25
* License: MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion dist/cordova-auth0-plugin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions src/authentication/db-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function DBConnection(request, options) {
* @see {@link https://auth0.com/docs/api/authentication#signup}
* @ignore
*/
DBConnection.prototype.signup = function(options, cb) {
DBConnection.prototype.signup = function (options, cb) {
var url;
var body;
var metadata;
Expand Down Expand Up @@ -96,7 +96,7 @@ DBConnection.prototype.signup = function(options, cb) {
* @see {@link https://auth0.com/docs/api/authentication#change-password}
* @ignore
*/
DBConnection.prototype.changePassword = function(options, cb) {
DBConnection.prototype.changePassword = function (options, cb) {
var url;
var body;

Expand All @@ -113,8 +113,8 @@ DBConnection.prototype.changePassword = function(options, cb) {
url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'change_password');

body = objectHelper
.merge(this.baseOptions, ['clientID'])
.with(options, ['email', 'connection']);
.merge(this.baseOptions, ['clientID', 'state'])
.with(options, ['email', 'connection', 'captcha']);

body = objectHelper.toSnakeCase(body, ['auth0Client']);

Expand All @@ -124,4 +124,19 @@ DBConnection.prototype.changePassword = function(options, cb) {
.end(responseHandler(cb));
};

DBConnection.prototype.getChallenge = function (cb) {
assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });

if (!this.baseOptions.state) {
return cb();
}

var url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'challenge');

return this.request
.post(url)
.send({ state: this.baseOptions.state })
.end(responseHandler(cb, { ignoreCasing: true }));
};

export default DBConnection;
Loading

0 comments on commit 94d41dc

Please sign in to comment.