Skip to content

Commit 94d41dc

Browse files
authored
Add APIs to get captcha challenge for reset password (#1426)
1 parent 105e67b commit 94d41dc

File tree

9 files changed

+179
-59
lines changed

9 files changed

+179
-59
lines changed

dist/auth0.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* auth0-js v9.24.1
33
* Author: Auth0
4-
* Date: 2024-01-04
4+
* Date: 2024-04-25
55
* License: MIT
66
*/
77

@@ -9528,7 +9528,7 @@
95289528
* @see {@link https://auth0.com/docs/api/authentication#signup}
95299529
* @ignore
95309530
*/
9531-
DBConnection.prototype.signup = function(options, cb) {
9531+
DBConnection.prototype.signup = function (options, cb) {
95329532
var url;
95339533
var body;
95349534
var metadata;
@@ -9587,7 +9587,7 @@
95879587
* @see {@link https://auth0.com/docs/api/authentication#change-password}
95889588
* @ignore
95899589
*/
9590-
DBConnection.prototype.changePassword = function(options, cb) {
9590+
DBConnection.prototype.changePassword = function (options, cb) {
95919591
var url;
95929592
var body;
95939593

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

96069606
body = objectHelper
9607-
.merge(this.baseOptions, ['clientID'])
9608-
.with(options, ['email', 'connection']);
9607+
.merge(this.baseOptions, ['clientID', 'state'])
9608+
.with(options, ['email', 'connection', 'captcha']);
96099609

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

@@ -9615,6 +9615,21 @@
96159615
.end(wrapCallback(cb));
96169616
};
96179617

9618+
DBConnection.prototype.getChallenge = function (cb) {
9619+
assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });
9620+
9621+
if (!this.baseOptions.state) {
9622+
return cb();
9623+
}
9624+
9625+
var url = urlJoin(this.baseOptions.rootUrl, 'dbconnections', 'challenge');
9626+
9627+
return this.request
9628+
.post(url)
9629+
.send({ state: this.baseOptions.state })
9630+
.end(wrapCallback(cb, { ignoreCasing: true }));
9631+
};
9632+
96189633
/**
96199634
* Creates a new Auth0 Authentication API client
96209635
* @constructor

dist/auth0.min.esm.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auth0.min.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auth0.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/auth0.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/cordova-auth0-plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* auth0-js v9.24.1
33
* Author: Auth0
4-
* Date: 2024-01-04
4+
* Date: 2024-04-25
55
* License: MIT
66
*/
77

dist/cordova-auth0-plugin.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/authentication/db-connection.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function DBConnection(request, options) {
3737
* @see {@link https://auth0.com/docs/api/authentication#signup}
3838
* @ignore
3939
*/
40-
DBConnection.prototype.signup = function(options, cb) {
40+
DBConnection.prototype.signup = function (options, cb) {
4141
var url;
4242
var body;
4343
var metadata;
@@ -96,7 +96,7 @@ DBConnection.prototype.signup = function(options, cb) {
9696
* @see {@link https://auth0.com/docs/api/authentication#change-password}
9797
* @ignore
9898
*/
99-
DBConnection.prototype.changePassword = function(options, cb) {
99+
DBConnection.prototype.changePassword = function (options, cb) {
100100
var url;
101101
var body;
102102

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

115115
body = objectHelper
116-
.merge(this.baseOptions, ['clientID'])
117-
.with(options, ['email', 'connection']);
116+
.merge(this.baseOptions, ['clientID', 'state'])
117+
.with(options, ['email', 'connection', 'captcha']);
118118

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

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

127+
DBConnection.prototype.getChallenge = function (cb) {
128+
assert.check(cb, { type: 'function', message: 'cb parameter is not valid' });
129+
130+
if (!this.baseOptions.state) {
131+
return cb();
132+
}
133+
134+
var url = urljoin(this.baseOptions.rootUrl, 'dbconnections', 'challenge');
135+
136+
return this.request
137+
.post(url)
138+
.send({ state: this.baseOptions.state })
139+
.end(responseHandler(cb, { ignoreCasing: true }));
140+
};
141+
127142
export default DBConnection;

0 commit comments

Comments
 (0)