Skip to content

Commit

Permalink
fix: otp
Browse files Browse the repository at this point in the history
  • Loading branch information
nevehallon committed Nov 7, 2023
1 parent f42949a commit f67d7da
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions bageldb-flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@
# 0.2.24

- Add: `updatePassword()` method

# 0.2.24

- Add: `validateOtp()` t query param to ensure the otp is valid
2 changes: 1 addition & 1 deletion bageldb-flutter/lib/src/bagel_db_users.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class BagelUsersRequest {
String? _nonce = _getOtpRequestNonce() ?? nonce;
if (_nonce.isEmpty)
throw ("Couldn't find OTP nonce, please run requestOTP first");
String url = '$authEndpoint/user/otp/verify/$_nonce';
String url = '$authEndpoint/user/otp/verify/$_nonce?t=${DateTime.now()}';
Map body = {"otp": otp};
try {
Response res = await dio.post(url, data: body);
Expand Down
2 changes: 1 addition & 1 deletion bageldb-flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: bagel_db
description: Dart plugin to retrieve and update data on BagelDB. This library allows you to build a backend in a matter of minutes, make REST API requests and manage your content easily
version: 0.2.24
version: 0.2.25
homepage: https://www.bageldb.com/

environment:
Expand Down
6 changes: 2 additions & 4 deletions bageldb-flutter/test/bagel_db_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ updateUserPasswordTest() {
group('phone auth test', () {
test('update user password test', () async {
try {
final res = await db.bagelUsersRequest.updatePassword(
testPhone,
"123123",
);
final res =
await db.bagelUsersRequest.updatePassword(testPhone, testPassword);
print({"res": res});
expect(res, isNotNull);
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion bageldb-js/src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default class BagelUsersRequest {
*/
async validateOtp(otp: string) {
const nonce = await this._getOtpRequestNonce();
const url = `${AUTH_ENDPOINT}/user/otp/verify/${nonce}`;
const url = `${AUTH_ENDPOINT}/user/otp/verify/${nonce}?t=${Date.now()}`;
const body = { otp };
try {
const res = await this.axios.post(url, body);
Expand Down

0 comments on commit f67d7da

Please sign in to comment.