Implement subscriber login.

agranig/peering-route
Andreas Granig 13 years ago
parent 1809b44245
commit 5160759f38

@ -83,18 +83,6 @@ __PACKAGE__->config(
},
'Plugin::Authentication' => {
default => {
credential => {
class => 'Password',
password_field => 'password',
password_type => 'clear'
},
store => {
class => 'Minimal',
users => {
}
}
},
reseller => {
credential => {
class => 'Password',
@ -122,6 +110,19 @@ __PACKAGE__->config(
id_field => 'id',
store_user_class => 'NGCP::Panel::AuthenticationStore::RoleFromRealm',
}
},
subscriber => {
credential => {
class => 'Password',
password_field => 'webpassword',
password_type => 'clear',
},
store => {
class => 'DBIx::Class',
user_model => 'DB::provisioning_voip_subscribers',
id_field => 'id',
store_user_class => 'NGCP::Panel::AuthenticationStore::RoleFromRealm',
}
}
}
);

@ -4,5 +4,9 @@ extends 'Catalyst::Authentication::Store::DBIx::Class::User';
sub roles {
my ($self) = @_;
if($self->auth_realm eq "subscriber" && $self->_user->admin) {
return "subscriberadmin";
}
return $self->auth_realm;
}

@ -27,12 +27,8 @@ sub index :Path Form {
my ( $self, $c, $realm ) = @_;
$c->log->debug("*** Login::index");
=pod
$realm = 'subscriber'
unless($realm and ($realm eq 'admin' or $realm eq 'reseller'));
=cut
$realm = 'admin'
unless($realm and ($realm eq 'reseller'));
my $form = NGCP::Panel::Form::Login->new;
$form->process(
@ -79,6 +75,21 @@ sub index :Path Form {
}
},
$realm);
} elsif($realm eq 'subscriber') {
# TODO: check for lock status?
$res = $c->authenticate(
{
webusername => $user,
webpassword => $pass,
'dbix_class' => {
searchargs => [{
-and => [
webusername => $user,
],
}],
}
},
$realm);
}
if($res) {

@ -9,7 +9,7 @@
<div class="login-extra">
Go to
[%
realms = ['admin', 'reseller'];
realms = ['subscriber', 'admin', 'reseller'];
links = [];
FOREACH r IN realms;
UNLESS realm == r;

Loading…
Cancel
Save