Skip to content

Commit

Permalink
Add sending verification email after linking email address (#1656)
Browse files Browse the repository at this point in the history
In the future, we should only send emails to verified email addresses.
Otherwise, it's likely that we'll have a high bounce rate, which could
cause our emails to be flagged as spam.

Users with Google and Apple providers don't need to verify their email
address.
  • Loading branch information
nilsreichardt authored Jun 11, 2024
1 parent 22e065c commit 29d9552
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/lib/util/api/user_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ class UserGateway implements UserGatewayAuthentifcation {
return;
}

@override
Future<void> sendVerificationEmail() async {
await authUser!.firebaseUser.sendEmailVerification();
}

Future<bool> deleteUser(SharezoneGateway gateway) async {
if (await hasInternetAccess()) {
final currentUser = references.firebaseAuth!.currentUser!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class LinkProviderGateway extends BlocBase {
final credential =
EmailAuthProvider.credential(email: email, password: password);
await userGateway.linkWithCredential(credential);
await userGateway.sendVerificationEmail();

_analytics.logEmailAndPasswordLink();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ import 'package:firebase_auth/firebase_auth.dart';

abstract class UserGatewayAuthentifcation {
Future<void> linkWithCredential(AuthCredential credential);
Future<void> sendVerificationEmail();
}

0 comments on commit 29d9552

Please sign in to comment.