diff options
author | Michael Scherer <misc@mageia.org> | 2010-12-06 01:15:53 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2010-12-06 01:15:53 +0000 |
commit | 0cb683bf2732d37d2c67a6f2e120e4fa08dbad9b (patch) | |
tree | b7d9bcf3e7931c0da14826494f5640f86851beb0 /lib | |
parent | f71b1ba9525fdde5533dbb18c1ca97612b0c45e8 (diff) | |
download | identity-0cb683bf2732d37d2c67a6f2e120e4fa08dbad9b.tar identity-0cb683bf2732d37d2c67a6f2e120e4fa08dbad9b.tar.gz identity-0cb683bf2732d37d2c67a6f2e120e4fa08dbad9b.tar.bz2 identity-0cb683bf2732d37d2c67a6f2e120e4fa08dbad9b.tar.xz identity-0cb683bf2732d37d2c67a6f2e120e4fa08dbad9b.zip |
- do not let users take a username that is used by the system ( will be completed with a 2nd configurable check, this one is just to take care of default users from the system )
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CatDap/Controller/register.pm | 10 |
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' |