Change all vars to snake_case (#5) + misc changes
- Remaining camelCase variables in `lib/CharmBoard/Controller/Register.pm` have been swapped to snake_case - Dev/prod environment check is now case insensitive - Change `pass_crypt => scheme` in conf to an array
This commit is contained in:
parent
1b179fb08d
commit
e86434f300
|
@ -10,7 +10,7 @@
|
|||
},
|
||||
|
||||
pass_crypt => {
|
||||
scheme => '', # currently only 'argon2'
|
||||
scheme => [''], # currently only 'argon2'
|
||||
pepper => ''
|
||||
},
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ sub startup {
|
|||
$self->helper(board_name => sub { $config->{board_name} });
|
||||
|
||||
# load dev env only stuff, if applicable
|
||||
if ($config->{environment} eq 'dev') {
|
||||
if (lc($config->{environment}) eq 'dev') {
|
||||
$self->renderer->cache->max_keys(0)
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,11 @@ sub register_do {
|
|||
my $password = $self->param('password');
|
||||
my $confirmPassword = $self->param('confirm-password');
|
||||
|
||||
my $catchError;
|
||||
my $catch_error;
|
||||
|
||||
# declare vars used through multiple try/catch blocks with
|
||||
# 'our' so they work throughout the entire subroutine
|
||||
our ($userCheck, $emailCheck, $salt, $hash);
|
||||
our ($user_check, $email_check, $salt, $hash);
|
||||
|
||||
# make sure registration info is valid
|
||||
try {
|
||||
|
@ -50,20 +50,20 @@ sub register_do {
|
|||
# check to make sure username and/or email isn't already in use;
|
||||
# if not, continue with registration
|
||||
## search for input username and email in database
|
||||
$userCheck = $self->schema->resultset('Users')
|
||||
$user_check = $self->schema->resultset('Users')
|
||||
->search({ username => $username })->single;
|
||||
$emailCheck = $self->schema->resultset('Users')
|
||||
$email_check = $self->schema->resultset('Users')
|
||||
->search({ email => $email })->single;
|
||||
|
||||
# TODO: compress this into something less redundant
|
||||
($userCheck && $emailCheck) eq undef
|
||||
($user_check && $email_check) eq undef
|
||||
or die "Username already in use.\nemail already in use.";
|
||||
($userCheck) eq undef
|
||||
($user_check) eq undef
|
||||
or die "Username already in use.";
|
||||
($emailCheck) eq undef
|
||||
($email_check) eq undef
|
||||
or die "email already in use."
|
||||
} catch ($catchError) {
|
||||
$self->flash(error => $catchError);
|
||||
} catch ($catch_error) {
|
||||
$self->flash(error => $catch_error);
|
||||
$self->redirect_to('register')
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ sub register_do {
|
|||
|
||||
$self->flash(message => 'User registered successfully!');
|
||||
$self->redirect_to('register')
|
||||
} catch ($catchError) {
|
||||
print $catchError;
|
||||
} catch ($catch_error) {
|
||||
print $catch_error;
|
||||
$self->flash(
|
||||
error =>
|
||||
'Your registration info was correct, but a server error
|
||||
|
|
Loading…
Reference in New Issue