Skip to content

Commit

Permalink
Merge pull request #682 from threefoldtech/development_fix_email_vali…
Browse files Browse the repository at this point in the history
…dation

Update regex of email validation
  • Loading branch information
AlaaElattar authored Nov 21, 2024
2 parents 36bb7e1 + 1760cd0 commit 34d5236
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/lib/services/tools_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:io';
import 'dart:math';

import 'package:device_info_plus/device_info_plus.dart';
import 'package:validators/validators.dart';

const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';

Expand All @@ -19,11 +20,14 @@ String randomString(int len) {
}

bool validateEmail(String? value) {
RegExp regex = RegExp(
r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a-zA-Z0-9])?)*$");
return regex.hasMatch(value.toString());
if (value == null || value.isEmpty) {
return false;
}

return isEmail(value);
}


bool validateSeedWords(String seed, String confirmationWords) {
List<String> words = confirmationWords.split(' ');
List<String> seedWords = seed.split(' ');
Expand Down

0 comments on commit 34d5236

Please sign in to comment.