File tree Expand file tree Collapse file tree 6 files changed +15
-0
lines changed
androidMain/kotlin/dev/gitlive/firebase/auth
commonMain/kotlin/dev/gitlive/firebase/auth
commonTest/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 6 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ actual class FirebaseUser internal constructor(val android: com.google.firebase.
67
67
get() = android.isAnonymous
68
68
actual suspend fun delete () = android.delete().await().run { Unit }
69
69
actual suspend fun reload () = android.reload().await().run { Unit }
70
+ actual suspend fun sendEmailVerification () = android.sendEmailVerification().await().run { Unit }
70
71
}
71
72
72
73
actual typealias FirebaseAuthException = com.google.firebase.auth.FirebaseAuthException
Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ expect class FirebaseUser {
37
37
val isAnonymous: Boolean
38
38
suspend fun delete ()
39
39
suspend fun reload ()
40
+ suspend fun sendEmailVerification ()
40
41
}
41
42
42
43
expect open class FirebaseAuthException : FirebaseException
Original file line number Diff line number Diff line change @@ -50,6 +50,16 @@ class FirebaseAuthTest {
50
50
signInResult.user!! .delete()
51
51
}
52
52
53
+ @Test
54
+ fun testSendEmailVerification () = runTest {
55
+ val email = " test+${Random .nextInt(100000 )} @test.com"
56
+ val createResult = Firebase .auth.createUserWithEmailAndPassword(email, " test123" )
57
+ assertNotEquals(null , createResult.user?.uid)
58
+ createResult.user!! .sendEmailVerification()
59
+
60
+ createResult.user!! .delete()
61
+ }
62
+
53
63
@Test
54
64
fun sendPasswordResetEmail () = runTest {
55
65
val email = " test+${Random .nextInt(100000 )} @test.com"
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ actual class FirebaseUser internal constructor(val ios: FIRUser) {
68
68
get() = ios.isAnonymous()
69
69
actual suspend fun delete () = ios.await { deleteWithCompletion(it) }.run { Unit }
70
70
actual suspend fun reload () = ios.await { reloadWithCompletion(it) }.run { Unit }
71
+ actual suspend fun sendEmailVerification () = ios.await { sendEmailVerificationWithCompletion(it) }.run { Unit }
71
72
}
72
73
73
74
actual open class FirebaseAuthException (message : String ): FirebaseException(message)
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ actual class FirebaseUser internal constructor(val js: firebase.user.User) {
63
63
get() = rethrow { js.isAnonymous }
64
64
actual suspend fun delete () = rethrow { js.delete().await() }
65
65
actual suspend fun reload () = rethrow { js.reload().await() }
66
+ actual suspend fun sendEmailVerification () = rethrow { js.sendEmailVerification().await() }
66
67
}
67
68
68
69
actual open class FirebaseAuthException (code : String? , cause : Throwable ): FirebaseException(code, cause)
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ external object firebase {
83
83
84
84
fun delete (): Promise <Unit >
85
85
fun reload (): Promise <Unit >
86
+ fun sendEmailVerification (): Promise <Unit >
86
87
}
87
88
}
88
89
You can’t perform that action at this time.
0 commit comments