diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-05-07 23:55:11 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-05-07 23:55:11 -0700 |
commit | 92a3df0360d3df6b6ace99fee3d4cc443e6154d0 (patch) | |
tree | 5c11c1c102f0d2f5deeb0d1aac2bb24aa4ed8327 /FS/FS/AuthCookieHandler.pm | |
parent | 9d35792778885932c09102bd011b518eb47c5131 (diff) |
NG auth: internal db auth, RT#21563
Diffstat (limited to 'FS/FS/AuthCookieHandler.pm')
-rw-r--r-- | FS/FS/AuthCookieHandler.pm | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/FS/FS/AuthCookieHandler.pm b/FS/FS/AuthCookieHandler.pm index a8ee370..cd89f55 100644 --- a/FS/FS/AuthCookieHandler.pm +++ b/FS/FS/AuthCookieHandler.pm @@ -4,34 +4,29 @@ use base qw( Apache2::AuthCookie ); use strict; use FS::UID qw( adminsuidsetup preuser_setup ); use FS::CurrentUser; - -my $module = 'legacy'; #XXX i am set in a conf somehow? or a config file +use FS::Auth; sub authen_cred { my( $self, $r, $username, $password ) = @_; + preuser_setup(); + unless ( _is_valid_user($username, $password) ) { warn "failed auth $username from ". $r->connection->remote_ip. "\n"; return undef; } warn "authenticated $username from ". $r->connection->remote_ip. "\n"; - adminsuidsetup($username); - FS::CurrentUser->new_session; + FS::CurrentUser->load_user($username); + FS::CurrentUser->new_session; } sub _is_valid_user { my( $username, $password ) = @_; - my $class = 'FS::Auth::'.$module; - - #earlier? - eval "use $class;"; - die $@ if $@; - - $class->authenticate($username, $password); + FS::Auth->authenticate($username, $password); } sub authen_ses_key { @@ -47,7 +42,6 @@ sub authen_ses_key { } $curuser->username; - } 1; |