mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
Remove custom email regexp
Use the EmailValidator package instead
This commit is contained in:
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:dynamic_theme/dynamic_theme.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:email_validator/email_validator.dart';
|
||||
import 'package:ext_storage/ext_storage.dart';
|
||||
import 'package:icloud_documents_path/icloud_documents_path.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
@ -120,11 +121,7 @@ class SettingsListState extends State<SettingsList> {
|
||||
return tr('settings.email.validator.empty');
|
||||
}
|
||||
|
||||
bool emailValid = RegExp(
|
||||
r"^[a-zA-Z0-9.\-!#$%&'*+/=?^_``{|}~]+@[a-zA-Z0-9\-]+\.[a-zA-Z\-]+")
|
||||
.hasMatch(value);
|
||||
|
||||
if (!emailValid) {
|
||||
if (!EmailValidator.validate(value)) {
|
||||
return tr('settings.email.validator.invalid');
|
||||
}
|
||||
return null;
|
||||
|
@ -220,6 +220,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.2"
|
||||
email_validator:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: email_validator
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.6"
|
||||
equatable:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -65,6 +65,7 @@ dependencies:
|
||||
permission_handler: ^5.0.1+1
|
||||
ext_storage: ^1.0.3
|
||||
time: ^1.3.0
|
||||
email_validator: ^1.0.6
|
||||
icloud_documents_path:
|
||||
git: https://github.com/GitJournal/icloud_documents_path.git
|
||||
|
||||
|
Reference in New Issue
Block a user