File tree Expand file tree Collapse file tree 5 files changed +13
-0
lines changed
androidMain/kotlin/dev/gitlive/firebase/auth
commonMain/kotlin/dev/gitlive/firebase/auth
iosMain/kotlin/dev/gitlive/firebase/auth
jsMain/kotlin/dev/gitlive/firebase/auth
firebase-common/src/jsMain/kotlin/dev/gitlive/firebase Expand file tree Collapse file tree 5 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ actual class FirebaseAuth internal constructor(val android: com.google.firebase.
21
21
actual val currentUser: FirebaseUser ?
22
22
get() = android.currentUser?.let { FirebaseUser (it) }
23
23
24
+ actual suspend fun sendPasswordResetEmail (email : String ) {
25
+ android.sendPasswordResetEmail(email).await()
26
+ }
27
+
24
28
actual suspend fun signInWithEmailAndPassword (email : String , password : String ) =
25
29
AuthResult (android.signInWithEmailAndPassword(email, password).await())
26
30
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ expect fun Firebase.auth(app: FirebaseApp): FirebaseAuth
17
17
expect class FirebaseAuth {
18
18
val currentUser: FirebaseUser ?
19
19
val authStateChanged: Flow <FirebaseUser ?>
20
+ suspend fun sendPasswordResetEmail (email : String )
20
21
suspend fun signInWithEmailAndPassword (email : String , password : String ): AuthResult
21
22
suspend fun createUserWithEmailAndPassword (email : String , password : String ): AuthResult
22
23
suspend fun signInWithCustomToken (token : String ): AuthResult
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ actual class FirebaseAuth internal constructor(val ios: FIRAuth) {
26
26
actual val currentUser: FirebaseUser ?
27
27
get() = ios.currentUser?.let { FirebaseUser (it) }
28
28
29
+ actual suspend fun sendPasswordResetEmail (email : String ) {
30
+ ios.await { sendPasswordResetWithEmail(email = email, completion = it) }
31
+ }
32
+
29
33
actual suspend fun signInWithEmailAndPassword (email : String , password : String ) =
30
34
AuthResult (ios.awaitResult { signInWithEmail(email = email, password = password, completion = it) })
31
35
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ actual class FirebaseAuth internal constructor(val js: firebase.auth.Auth) {
20
20
actual val currentUser: FirebaseUser ?
21
21
get() = rethrow { js.currentUser?.let { FirebaseUser (it) } }
22
22
23
+ actual suspend fun sendPasswordResetEmail (email : String ) =
24
+ rethrow { js.sendPasswordResetEmail(email).await() }
25
+
23
26
actual suspend fun signInWithEmailAndPassword (email : String , password : String ) =
24
27
rethrow { AuthResult (js.signInWithEmailAndPassword(email, password).await()) }
25
28
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ external object firebase {
57
57
open class Auth {
58
58
val currentUser: user.User ?
59
59
60
+ fun sendPasswordResetEmail (email : String ): Promise <Unit >
60
61
fun signInWithEmailAndPassword (email : String , password : String ): Promise <AuthResult >
61
62
fun createUserWithEmailAndPassword (email : String , password : String ): Promise <AuthResult >
62
63
fun signInWithCustomToken (token : String ): Promise <AuthResult >
You can’t perform that action at this time.
0 commit comments