Add client side validation to prevent the user from sharing the album with themselves

This commit is contained in:
Vishnu Mohandas 2020-10-17 23:48:28 +05:30
parent 0b407ef98d
commit b8a627a1a3

View file

@ -147,7 +147,11 @@ class _SharingDialogState extends State<SharingDialog> {
Future<void> _addEmailToCollection(BuildContext context) async {
if (!isValidEmail(_email)) {
showErrorDialog(context, "Invalid email address",
"Please enter a valid email address");
"Please enter a valid email address.");
return;
} else if (_email == Configuration.instance.getEmail()) {
showErrorDialog(
context, "Oops", "You cannot share the album with yourself.");
return;
}
final dialog = createProgressDialog(context, "Searching for user...");