aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/CatDap/Controller/register.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/CatDap/Controller/register.pm b/lib/CatDap/Controller/register.pm
index c90032d..ed3075b 100644
--- a/lib/CatDap/Controller/register.pm
+++ b/lib/CatDap/Controller/register.pm
@@ -51,6 +51,16 @@ sub check : Local {
if (! $c->validate_captcha($c->req->param('validate'))){
push @errors, $c->loc('Incorrect validation text, please try again');
}
+
+ if ( ! open( my $etcpasswd, "/etc/passwd")) {
+ push @errors, $c->loc('Cannot check /etc/passwd, please warn system administrators');
+ } else {
+ if ( grep { /^$username:/ } <$etcpasswd> ) {
+ push @errors, $c->loc('Invalid username, already used by system');
+ }
+ close($etcpasswd);
+ }
+
if ($c->request->params->{gn} !~ /^\p{IsAlnum}+$/) {
push @errors, $c->loc(
'The first name supplied contains illegal characters'