implemented getFieldNamesByCategory() in the user data source, and used it to fill in the list of contact methods for the loginFailed output handler.

This commit is contained in:
ian%hixie.ch 2001-11-10 10:55:33 +00:00
parent 25760a3e0a
commit b5ef59ba98
3 changed files with 19 additions and 1 deletions

View File

@ -155,6 +155,13 @@ sub getFieldByName {
# return [type, fieldID, category, name, typeData]
}
sub getFieldNamesByCategory {
my $self = shift;
my($app, $category) = @_;
$self->notImplemented();
# return [name, name, name, name ...]
}
sub setField {
my $self = shift;
my($app, $fieldID, $category, $name, $type, $data) = @_;

View File

@ -171,6 +171,17 @@ sub getFieldByName {
# return [type, fieldID, category, name, typeData]
}
sub getFieldNamesByCategory {
my $self = shift;
my($app, $category) = @_;
my $rows = $self->database($app)->execute('SELECT name FROM userDataTypes WHERE category = ?', $category)->rows;
foreach my $row (@$rows) {
$row = $row->[0];
}
return @$rows;
# return [name, name, name, name ...]
}
sub setField {
my $self = shift;
my($app, $fieldID, $category, $name, $type, $data, $mode) = @_;

View File

@ -161,7 +161,7 @@ sub outputLoginFailed {
my($app, $output, $tried) = @_;
$output->output('login.failed', {
'tried' => $tried, # 0 = no username; 1 = unknown username; 2 = invalid username
'contacts' => 0, # XXX should fill this in
'contacts' => [$app->getService('dataSource.user')->getFieldNamesByCategory($app, 'contact')],
});
}