aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem.moulin@fripost.org>2012-05-03 20:08:30 +0200
committerGuilhem Moulin <guilhem.moulin@fripost.org>2012-05-03 20:08:30 +0200
commit8bbf67de5056e1a0ee59dc1ff104223ec32df2f2 (patch)
tree9e1847b90816f0bca7ebf9834362de537bc12ccb
parenta6bd894f302df904588df739f79f1b17b329a0e4 (diff)
Ensure that the new domain is valid.
-rwxr-xr-xfripost-newdomain6
1 files changed, 5 insertions, 1 deletions
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