Commit bbd05fdd authored by Clément OUDOT's avatar Clément OUDOT
Browse files

Allow to search demo account from mail reset page (#586)

parent 5b9cab0c
......@@ -8,7 +8,7 @@ package Lemonldap::NG::Portal::UserDBDemo;
use strict;
use Lemonldap::NG::Portal::Simple;
our $VERSION = '1.2.0';
our $VERSION = '1.3.0';
## @apmethod int userDBInit()
# Check AuthDemo use
......@@ -17,6 +17,10 @@ sub userDBInit {
my $self = shift;
if ( $self->get_module('auth') eq 'Demo' ) {
# Call authInit if demo accounts not found
$self->authInit() unless defined $self->{_demoAccounts};
return PE_OK;
}
else {
......@@ -33,10 +37,23 @@ sub userDBInit {
sub getUser {
my $self = shift;
return PE_USERNOTFOUND
unless ( defined $self->{_demoAccounts}->{ $self->{user} } );
# Search by login
if ( $self->{user} ) {
return PE_OK
if ( defined $self->{_demoAccounts}->{ $self->{user} } );
}
# Search by mail
if ( $self->{mail} ) {
foreach my $user ( keys %{ $self->{_demoAccounts} } ) {
if ( $self->{_demoAccounts}->{$user}->{mail} eq $self->{mail} ) {
$self->{user} = $user;
return PE_OK;
}
}
}
PE_OK;
PE_USERNOTFOUND;
}
## @apmethod int setSessionInfo()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment