Initialize project and update portal port configuration
Set default portal port to 8081, fix Dart build issue in cart screen, and update setup documentation. Co-Authored-By: Oz <oz-agent@warp.dev>
This commit is contained in:
48
lib/services/auth_service.dart
Normal file
48
lib/services/auth_service.dart
Normal file
@ -0,0 +1,48 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
|
||||
class AuthService {
|
||||
AuthService._();
|
||||
|
||||
static final AuthService instance = AuthService._();
|
||||
final FirebaseAuth _auth = FirebaseAuth.instance;
|
||||
|
||||
Stream<User?> authStateChanges() => _auth.authStateChanges();
|
||||
|
||||
User? get currentUser => _auth.currentUser;
|
||||
|
||||
Future<UserCredential> signInWithEmailPassword({
|
||||
required String email,
|
||||
required String password,
|
||||
}) {
|
||||
return _auth.signInWithEmailAndPassword(email: email, password: password);
|
||||
}
|
||||
|
||||
Future<UserCredential> registerWithEmailPassword({
|
||||
required String email,
|
||||
required String password,
|
||||
}) {
|
||||
return _auth.createUserWithEmailAndPassword(
|
||||
email: email,
|
||||
password: password,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> sendPasswordResetEmail(String email) {
|
||||
return _auth.sendPasswordResetEmail(email: email);
|
||||
}
|
||||
|
||||
Future<UserCredential> signInWithGoogle() {
|
||||
final provider = GoogleAuthProvider();
|
||||
provider.setCustomParameters({'prompt': 'select_account'});
|
||||
return _auth.signInWithPopup(provider);
|
||||
}
|
||||
|
||||
Future<UserCredential> signInWithGithub() {
|
||||
final provider = GithubAuthProvider();
|
||||
return _auth.signInWithPopup(provider);
|
||||
}
|
||||
|
||||
Future<void> signOut() {
|
||||
return _auth.signOut();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user