Commit 19e56501 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

fixed LDAP auth

parent d94b3674
......@@ -9,6 +9,7 @@ use DBIx::Connector;
use Moose;
use YAML;
use Ravada::Auth;
use Ravada::Request;
use Ravada::VM::KVM;
use Ravada::VM::LXC;
......@@ -73,7 +74,7 @@ sub BUILD {
$CONNECTOR = $self->_connect_dbh();
$self->connector($CONNECTOR);
}
Ravada::Auth::init($CONFIG);
}
sub _connect_dbh {
......
......@@ -16,14 +16,18 @@ sub init {
my ($config, $db_con) = @_;
if ($config->{ldap}) {
Ravada::Auth::LDAP::init($config);
warn "LDAP enabled";
} else {
$LDAP = 0;
}
Ravada::Auth::SQL::init($config, $db_con);
# Ravada::Auth::SQL::init($config, $db_con);
}
sub login {
eval { return Ravada::Auth::LDAP::login(@_) if $LDAP };
my ($name, $pass) = @_;
return Ravada::Auth::LDAP->new(name => $name, password => $pass)
if $LDAP;
if ($@ =~ /I can't connect/i) {
$LDAP = 0;
warn $@;
......
......@@ -209,6 +209,7 @@ sub login {
my $self = shift;
my ($username, $password) = ($self->name , $self->password);
_init_ldap_admin();
my $entry = search_user($username);
my $user_dn;
......
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