Skip to content

Commit d1b8891

Browse files
authored
fix(types): fix arguments in resetPassword - #803 - @magrinj
fix(docs): documentation about resetPassword - #803 - @magrinj
2 parents bca2a49 + fd5f4c3 commit d1b8891

File tree

5 files changed

+10
-24
lines changed

5 files changed

+10
-24
lines changed

docs/api/firebaseInstance.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,7 @@ Sends password reset email
449449

450450
### Parameters
451451

452-
- `credentials` **[object][66]** Credentials for authenticating
453-
- `credentials.email` **[string][69]** Credentials for authenticating
452+
- `email` **[string][69]** Email to send recovery email to
454453

455454
Returns **[Promise][72]** Resolves after password reset email is sent
456455

docs/auth.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,17 @@ Looking to preserve data on logout? [checkout the `preserve` config option](/doc
204204
props.firebase.logout()
205205
```
206206
207-
## resetPassword(credentials)
207+
## resetPassword(email)
208208
Calls Firebase's `firebase.auth().resetPassword()`. If there is an error, it is added into redux state under `state.firebase.authError`.
209209

210210
##### Examples
211211

212212
```js
213-
props.firebase.resetPassword({
214-
215-
password: 'testest1',
216-
username: 'tester'
217-
})
213+
props.firebase.resetPassword('[email protected]')
218214
```
219215

220216
##### Parameters
221-
* `credentials` [**Object**][object-url] - Credentials same as described in firebase docs
222-
* `profile` [**Object**][object-url] - if initialized with userProfile support then profile will be saved into `${userProfile}/${auth.uid}`
217+
* `email` [**String**][string-url] - Email to send recovery email to
223218

224219
##### Returns
225220
[**Promise**][promise-url] with user's UID in case of success or the error otherwise.

index.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,10 @@ interface ExtendedAuthInstance {
620620

621621
/**
622622
* Sends password reset email.
623-
* @param credentials - Credentials for authenticating
623+
* @param email - Email to send recovery email to
624624
* @see https://react-redux-firebase.com/docs/auth.html#resetpasswordcredentials
625625
*/
626-
resetPassword: (
627-
credentials: AuthTypes.UserCredential,
628-
profile: UserProfile
629-
) => Promise<any>
626+
resetPassword: (email: string) => Promise<any>
630627

631628
/**
632629
* Confirm that a user's password has been reset.

src/createFirebaseInstance.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,12 @@ export default function createFirebaseInstance(firebase, configs, dispatch) {
429429

430430
/**
431431
* Sends password reset email
432-
* @param {object} credentials - Credentials for authenticating
433-
* @param {string} credentials.email - Credentials for authenticating
432+
* @param {string} email - Email to send recovery email to
434433
* @returns {Promise} Resolves after password reset email is sent
435434
* @see https://react-redux-firebase.com/docs/api/firebaseInstance.html#resetpassword
436435
*/
437-
const resetPassword = credentials =>
438-
authActions.resetPassword(dispatch, firebase, credentials)
436+
const resetPassword = email =>
437+
authActions.resetPassword(dispatch, firebase, email)
439438

440439
/**
441440
* Confirm that a user's password has been reset

test/unit/createFirebaseInstance.spec.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,7 @@ describe('createFirebaseInstance', () => {
548548

549549
expect(firebaseInstance.resetPassword).to.be.a.function
550550
const email = '[email protected]'
551-
const password = 'asdfasdf1'
552-
await firebaseInstance.resetPassword({
553-
email,
554-
password
555-
})
551+
await firebaseInstance.resetPassword(email)
556552
// signInWithEmailAndPassword is called on resetPassword with email
557553
expect(resetPasswordSpy).to.have.been.calledOnce
558554
})

0 commit comments

Comments
 (0)