Catalyst::Exception->throw("user table does not contain a single primary key column - please specify 'id_field' in config!");
}
}
+ if (not $self->{'resultset'}) {
+ Catalyst::Exception->throw("\$c->model('${ \$self->config->{user_class} }') did not return a resultset. Did you set user_class correctly?");
+ }
if (!$self->{'resultset'}->result_source->has_column($self->config->{'id_field'})) {
Catalyst::Exception->throw("id_field set to " . $self->config->{'id_field'} . " but user table has no column by that name!");
}
$searchargs->{$key} = $authinfo->{$key};
}
}
- $self->_user($self->resultset->search($searchargs)->first);
+ if (keys %{$searchargs}) {
+ $self->_user($self->resultset->search($searchargs)->first);
+ } else {
+ Catalyst::Exception->throw("User retrieval failed: no columns from " . $self->config->{'user_class'} . " were provided");
+ }
}
if ($self->get_object) {
if (exists($self->config->{'role_column'})) {
my $role_data = $self->get($self->config->{'role_column'});
if ($role_data) {
- @roles = split /[ ,\|]+/, $self->get($self->config->{'role_column'});
+ @roles = split /[\s,\|]+/, $self->get($self->config->{'role_column'});
}
$self->_roles(\@roles);
} elsif (exists($self->config->{'role_relation'})) {
=head2 for_session
-Returns a serialized user for storage in the session. Currently, this is the value of the field
-specified by the 'id_field' config variable.
+Returns a serialized user for storage in the session.
=head2 from_session
-Revives a serialized user from storage in the session. Currently, this uses the serialized data as the
-value of the 'id_field' config variable.
+Revives a serialized user from storage in the session.
=head2 get ( $fieldname )