blob: 3b6844ceaebe2dbf1f6c702522ebbd8b241fde98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
import 'package:firebase_auth/firebase_auth.dart';
class EmailAuth {
final FirebaseAuth _auth = FirebaseAuth.instance;
Future<bool> createUserWithEmailAndPassword({
required String email,
required String password,
}) async {
try {
await _auth.createUserWithEmailAndPassword(
email: email,
password: password,
);
return true;
} catch (e) {
print(e);
return false;
}
}
Future<bool> signInWithEmailAndPassword({
required String email,
required String password,
}) async {
try {
UserCredential cred = await _auth.signInWithEmailAndPassword(
email: email,
password: password,
);
return cred.user?.emailVerified == true;
} catch (e) {
print(e);
return false;
}
}
}
|