Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core/services/input_validation_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../../shared/theme/conduit_input_styles.dart';
class InputValidationService {
// Email regex pattern
static final RegExp _emailRegex = RegExp(
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$',
r'^[a-zA-Z0-9._%+-]+@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,}|localhost)$',
);

// Strong password regex (min 8 chars, 1 upper, 1 lower, 1 number, 1 special)
Expand Down
5 changes: 5 additions & 0 deletions test/core/services/input_validation_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ void main() {
.isNull();
});

test('returns null for email with localhost domain', () {
check(InputValidationService.validateEmail('user@localhost'))
.isNull();
});

test('returns error for invalid email without domain', () {
check(InputValidationService.validateEmail('user@'))
.isA<String>();
Expand Down