Skip to content

Commit

Permalink
Item9790: Password and Email registration fixes
Browse files Browse the repository at this point in the history
If the Password field is empty, treat it as missing. It's more common to
generate a password reset during bulk registration, so treat empty field
in the input table as missing.

Also fix a undefined variable error, if the email field is missing.
  • Loading branch information
gac410 committed Mar 1, 2016
1 parent 81bf90b commit f2302fa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/lib/Foswiki/UI/Register.pm
Expand Up @@ -422,6 +422,13 @@ sub bulkRegister {
next;
}

# If password column is empty, just delete them to avoid errors in validation.
# Passwords are generally sent as a bulk reset after registration.
unless ( length( $row->{Password} ) > 0 ) {
delete $row->{Password};
delete $row->{Confirm};
}

# If a password is provided but no Confirm column, just
# set Confirm to the password. Confirmation really doesn't make sense here,
unless ( exists $row->{Password} && exists $row->{Confirm} ) {
Expand Down Expand Up @@ -1790,7 +1797,9 @@ sub _validateRegistration {
}

# check valid email address
if ( $data->{Email} !~ $Foswiki::regex{emailAddrRegex} ) {
if ( !defined $data->{Email}
|| $data->{Email} !~ $Foswiki::regex{emailAddrRegex} )
{
$data->{Email} ||= '';
$session->logger->log( 'warning',
"Registration rejected: $data->{Email} failed the system email regex check."
Expand Down

0 comments on commit f2302fa

Please sign in to comment.