From 8bbf67de5056e1a0ee59dc1ff104223ec32df2f2 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 3 May 2012 20:08:30 +0200 Subject: Ensure that the new domain is valid. --- fripost-newdomain | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'fripost-newdomain') diff --git a/fripost-newdomain b/fripost-newdomain index b9fcecc..5c4c2fb 100755 --- a/fripost-newdomain +++ b/fripost-newdomain @@ -147,8 +147,12 @@ my $ldap = Fripost::Schema->new( $conf ); my %domain; $domain{domain} = $ARGV[0]; $domain{domain} //= prompt "Domain name: "; -# TODO: Ensure that the domain is valid. $domain{isActive} = 'TRUE'; + +# Ensure that the domain is valid. +Email::Valid->address('test@'.$domain{domain}) + or die "Error: Invalid domain `$domain{domain}'.\n"; + if (defined $conf->{owner}) { if ($conf->{owner} eq '') { $domain{owner} = undef -- cgit v1.2.3