+++ /dev/null
-import { FormControl } from '@angular/forms';
-
-export function validateEmail(c: FormControl) {
- // Thanks to http://emailregex.com/
- /* tslint:disable */
- const EMAIL_REGEXP = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
-
- return EMAIL_REGEXP.test(c.value) ? null : {
- email: {
- valid: false
- }
- };
-}
import { Validators } from '@angular/forms';
-import { validateEmail } from './email.validator';
-
export const USER_USERNAME = {
VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(20) ],
MESSAGES: {
}
};
export const USER_EMAIL = {
- VALIDATORS: [ Validators.required, validateEmail ],
+ VALIDATORS: [ Validators.required, Validators.email ],
MESSAGES: {
'required': 'Email is required.',
'email': 'Email must be valid.',