Skip to content

Commit

Permalink
Merge branch 'release/6.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAsterisco committed Apr 14, 2024
2 parents ea70fb8 + d0f5dfd commit a7700aa
Show file tree
Hide file tree
Showing 158 changed files with 269 additions and 184 deletions.
92 changes: 57 additions & 35 deletions Example/RxFireAuth macOS/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions Example/RxFireAuth macOS/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,25 @@ class ViewController: NSViewController {
self.confirmAuthentication(for: provider)
}

@IBAction func resetPassword(sender: AnyObject) {
guard !loginField.stringValue.isEmpty else {
show(title: "Insert your Email!", message: "Use the field above to input your email address.")
return
}

let email = loginField.stringValue

toggleProgress(true)
userManager.resetPassword(for: email)
.subscribe(onCompleted: { [unowned self] in
show(
title: "Password Reset Email Sent!",
message: "If \(email) is associated to a valid account, you will find an email in your inbox with instructions to reset your password."
)
})
.disposed(by: disposeBag)
}

// MARK: - Logic

private func showMacOS1015OrLater() {
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ or Google Sign In:
func confirmAuthenticationWithGoogle(as clientId: String, in viewController: UIViewController) -> Completable
```

## Password Reset

With version 6.2.0, RxFireAuth introduces a new method to reset the user password. You can call:

```swift
func resetPassword(for email: String) -> Completable
```

This method will send an email to the user with a link to reset their password. You can customize the email content, sender, and more in the Firebase Console.

## Documentation

**Always refer to the `UserManagerType` and `LoginProviderManagerType` protocols** in your code, because the `UserManager` implementation may introduce breaking changes over time even if the library major version hasn't changed.
Expand Down
17 changes: 17 additions & 0 deletions RxFireAuth/Classes/UserManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,23 @@ public class UserManager: UserManagerType {

// MARK: - Password Management

public func resetPassword(for email: String) -> Completable {
Completable.create { [unowned self] observer -> Disposable in
let disposable = Disposables.create { }

Auth.auth().sendPasswordReset(withEmail: email) { error in
guard !disposable.isDisposed else { return }
if let error {
observer(.error(map(error: error)))
} else {
observer(.completed)
}
}

return disposable
}
}

public func updatePassword(newPassword: String) -> Completable {
return Completable.deferred { [unowned self] in
guard
Expand Down
13 changes: 13 additions & 0 deletions RxFireAuth/Classes/UserManagerType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,19 @@ public protocol UserManagerType {

// MARK: - Password Management

/// Trigger the password reset flow for the specified email address.
///
/// This function will send an email to the specified address with a link to reset the password.
/// The password reset will happen on the web.
///
/// - note: If [Email Enumeration Protection](https://cloud.google.com/identity-platform/docs/admin/email-enumeration-protection)
/// is turned on in your project, this function will **not** fail for unexisting email addresses.
///
/// - parameters:
/// - email: A email address.
/// - returns: A Completable action to observe.
func resetPassword(for email: String) -> Completable

/// Update or set the password of the currently signed in user.
///
/// If the user does not have `password` among their `authenticationProviders`,
Expand Down
2 changes: 1 addition & 1 deletion docs/data/documentation/rxfireauth.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"topicSections":[{"identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password"],"title":"Enumeration Cases"},{"identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)"],"title":"Initializers"},{"identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations"],"title":"Default Implementations","generated":true}],"abstract":[{"text":"An authentication provider.","type":"text"}],"schemaVersion":{"major":0,"minor":3,"patch":0},"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"text":"AuthenticationProvider","kind":"identifier"}],"platforms":["macOS"],"languages":["swift"]}]},{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"overview"},{"type":"aside","name":"Since","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"version 4.0.0"}]}],"style":"note"}]}],"identifier":{"url":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","interfaceLanguage":"swift"},"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/rxfireauth\/authenticationprovider"]}],"hierarchy":{"paths":[["doc:\/\/RxFireAuth\/documentation\/RxFireAuth"]]},"kind":"symbol","relationshipsSections":[{"identifiers":["doc:\/\/RxFireAuth\/SQ","doc:\/\/RxFireAuth\/SH","doc:\/\/RxFireAuth\/SY"],"kind":"relationships","title":"Conforms To","type":"conformsTo"}],"metadata":{"externalID":"s:10RxFireAuth22AuthenticationProviderO","fragments":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"text":"AuthenticationProvider","kind":"identifier"}],"roleHeading":"Enumeration","title":"AuthenticationProvider","navigatorTitle":[{"text":"AuthenticationProvider","kind":"identifier"}],"symbolKind":"enum","modules":[{"name":"RxFireAuth"}],"role":"symbol"},"sections":[],"references":{"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/RawRepresentable-Implementations":{"kind":"article","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations","url":"\/documentation\/rxfireauth\/authenticationprovider\/rawrepresentable-implementations","title":"RawRepresentable Implementations","role":"collectionGroup","type":"topic","abstract":[]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/google":{"type":"topic","kind":"symbol","url":"\/documentation\/rxfireauth\/authenticationprovider\/google","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","role":"symbol","title":"AuthenticationProvider.google","fragments":[{"text":"case","kind":"keyword"},{"text":" ","kind":"text"},{"text":"google","kind":"identifier"}],"abstract":[{"type":"text","text":"Google Sign In"}]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/Equatable-Implementations":{"title":"Equatable Implementations","type":"topic","role":"collectionGroup","url":"\/documentation\/rxfireauth\/authenticationprovider\/equatable-implementations","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","kind":"article","abstract":[]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/apple":{"title":"AuthenticationProvider.apple","abstract":[{"type":"text","text":"Sign in with Apple."}],"fragments":[{"kind":"keyword","text":"case"},{"text":" ","kind":"text"},{"text":"apple","kind":"identifier"}],"url":"\/documentation\/rxfireauth\/authenticationprovider\/apple","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","kind":"symbol","role":"symbol","type":"topic"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/password":{"title":"AuthenticationProvider.password","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password","url":"\/documentation\/rxfireauth\/authenticationprovider\/password","type":"topic","kind":"symbol","role":"symbol","abstract":[{"type":"text","text":"Email & Password"}],"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"password"}]},"doc://RxFireAuth/documentation/RxFireAuth":{"title":"RxFireAuth","abstract":[],"type":"topic","kind":"symbol","role":"collection","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth","url":"\/documentation\/rxfireauth"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/init(rawValue:)":{"abstract":[],"kind":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)","role":"symbol","type":"topic","url":"\/documentation\/rxfireauth\/authenticationprovider\/init(rawvalue:)","fragments":[{"kind":"identifier","text":"init"},{"kind":"text","text":"?("},{"kind":"externalParam","text":"rawValue"},{"text":": ","kind":"text"},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"},{"text":")","kind":"text"}],"title":"init(rawValue:)"},"doc://RxFireAuth/SY":{"identifier":"doc:\/\/RxFireAuth\/SY","title":"Swift.RawRepresentable","type":"unresolvable"},"doc://RxFireAuth/SQ":{"identifier":"doc:\/\/RxFireAuth\/SQ","title":"Swift.Equatable","type":"unresolvable"},"doc://RxFireAuth/SH":{"identifier":"doc:\/\/RxFireAuth\/SH","title":"Swift.Hashable","type":"unresolvable"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider":{"identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","abstract":[{"text":"An authentication provider.","type":"text"}],"url":"\/documentation\/rxfireauth\/authenticationprovider","role":"symbol","kind":"symbol","title":"AuthenticationProvider","fragments":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"AuthenticationProvider"}],"type":"topic","navigatorTitle":[{"text":"AuthenticationProvider","kind":"identifier"}]}}}
{"kind":"symbol","schemaVersion":{"major":0,"patch":0,"minor":3},"topicSections":[{"title":"Enumeration Cases","identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password"]},{"title":"Initializers","identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)"]},{"identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations"],"generated":true,"title":"Default Implementations"}],"abstract":[{"text":"An authentication provider.","type":"text"}],"relationshipsSections":[{"kind":"relationships","title":"Conforms To","type":"conformsTo","identifiers":["doc:\/\/RxFireAuth\/SQ","doc:\/\/RxFireAuth\/SH","doc:\/\/RxFireAuth\/SY"]}],"identifier":{"url":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","interfaceLanguage":"swift"},"hierarchy":{"paths":[["doc:\/\/RxFireAuth\/documentation\/RxFireAuth"]]},"metadata":{"symbolKind":"enum","modules":[{"name":"RxFireAuth"}],"title":"AuthenticationProvider","fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"text":"AuthenticationProvider","kind":"identifier"}],"navigatorTitle":[{"text":"AuthenticationProvider","kind":"identifier"}],"externalID":"s:10RxFireAuth22AuthenticationProviderO","role":"symbol","roleHeading":"Enumeration"},"sections":[],"primaryContentSections":[{"declarations":[{"languages":["swift"],"platforms":["macOS"],"tokens":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"AuthenticationProvider"}]}],"kind":"declarations"},{"kind":"content","content":[{"level":2,"anchor":"overview","text":"Overview","type":"heading"},{"style":"note","type":"aside","name":"Since","content":[{"type":"paragraph","inlineContent":[{"text":"version 4.0.0","type":"text"}]}]}]}],"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/rxfireauth\/authenticationprovider"]}],"references":{"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/RawRepresentable-Implementations":{"type":"topic","title":"RawRepresentable Implementations","abstract":[],"role":"collectionGroup","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations","kind":"article","url":"\/documentation\/rxfireauth\/authenticationprovider\/rawrepresentable-implementations"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/password":{"type":"topic","title":"AuthenticationProvider.password","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"text":"password","kind":"identifier"}],"abstract":[{"text":"Email & Password","type":"text"}],"role":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password","kind":"symbol","url":"\/documentation\/rxfireauth\/authenticationprovider\/password"},"doc://RxFireAuth/SY":{"identifier":"doc:\/\/RxFireAuth\/SY","title":"Swift.RawRepresentable","type":"unresolvable"},"doc://RxFireAuth/documentation/RxFireAuth":{"title":"RxFireAuth","url":"\/documentation\/rxfireauth","kind":"symbol","type":"topic","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth","abstract":[],"role":"collection"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider":{"type":"topic","title":"AuthenticationProvider","fragments":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"AuthenticationProvider"}],"abstract":[{"text":"An authentication provider.","type":"text"}],"navigatorTitle":[{"text":"AuthenticationProvider","kind":"identifier"}],"role":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","kind":"symbol","url":"\/documentation\/rxfireauth\/authenticationprovider"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/google":{"type":"topic","title":"AuthenticationProvider.google","fragments":[{"text":"case","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"google"}],"abstract":[{"text":"Google Sign In","type":"text"}],"role":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","kind":"symbol","url":"\/documentation\/rxfireauth\/authenticationprovider\/google"},"doc://RxFireAuth/SQ":{"identifier":"doc:\/\/RxFireAuth\/SQ","title":"Swift.Equatable","type":"unresolvable"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/apple":{"role":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","kind":"symbol","title":"AuthenticationProvider.apple","url":"\/documentation\/rxfireauth\/authenticationprovider\/apple","type":"topic","abstract":[{"text":"Sign in with Apple.","type":"text"}],"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"text":"apple","kind":"identifier"}]},"doc://RxFireAuth/SH":{"identifier":"doc:\/\/RxFireAuth\/SH","title":"Swift.Hashable","type":"unresolvable"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/init(rawValue:)":{"role":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)","kind":"symbol","title":"init(rawValue:)","url":"\/documentation\/rxfireauth\/authenticationprovider\/init(rawvalue:)","type":"topic","abstract":[],"fragments":[{"text":"init","kind":"identifier"},{"kind":"text","text":"?("},{"kind":"externalParam","text":"rawValue"},{"text":": ","kind":"text"},{"text":"String","kind":"typeIdentifier","preciseIdentifier":"s:SS"},{"text":")","kind":"text"}]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/Equatable-Implementations":{"role":"collectionGroup","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","kind":"article","title":"Equatable Implementations","url":"\/documentation\/rxfireauth\/authenticationprovider\/equatable-implementations","type":"topic","abstract":[]}}}
Loading

0 comments on commit a7700aa

Please sign in to comment.