diff options
author | Nicolas Vigier <boklm@mageia.org> | 2012-07-06 16:42:13 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-09-22 09:12:07 +0000 |
commit | 1706718d3ca2f60984eba1ea7739a366fff93684 (patch) | |
tree | 40b12b99d607bf7a2ccc1dfdb57de5bdd7440508 | |
parent | 2c0d061e81a3096412e4596358b9b3d8707447ef (diff) | |
download | identity-1706718d3ca2f60984eba1ea7739a366fff93684.tar identity-1706718d3ca2f60984eba1ea7739a366fff93684.tar.gz identity-1706718d3ca2f60984eba1ea7739a366fff93684.tar.bz2 identity-1706718d3ca2f60984eba1ea7739a366fff93684.tar.xz identity-1706718d3ca2f60984eba1ea7739a366fff93684.zip |
add option to change the regex used to validate username
(cherry picked from commit ac112f8b9454b5e4ec4bac614358318ef7c3b664)
-rw-r--r-- | catdap.yml | 1 | ||||
-rw-r--r-- | lib/CatDap/Controller/register.pm | 3 |
2 files changed, 3 insertions, 1 deletions
@@ -32,6 +32,7 @@ Model::User: start_tls: 1 register: + login_regex: ^[a-z][a-z0-9_-]*$ login_blacklist: - apache diff --git a/lib/CatDap/Controller/register.pm b/lib/CatDap/Controller/register.pm index 76614bc..89b54b4 100644 --- a/lib/CatDap/Controller/register.pm +++ b/lib/CatDap/Controller/register.pm @@ -40,7 +40,8 @@ sub check : Local { my @errors; $c->stash(errors => []); # Check username, start with letter, followed by letters or numbers - if ($username !~ /^[a-z][a-z0-9_-]*$/) { + my $login_regex = ${$c->config}{'register'}{'login_regex'}; + if ($username !~ /$login_regex/) { push @errors, $c->loc('Invalid username'); } my $email = $c->request->params->{mail1}; |