[Rt-commit] r4139 - in rt/branches/3.7-EXPERIMENTAL: . html
ruz at bestpractical.com
ruz at bestpractical.com
Tue Nov 22 21:36:33 EST 2005
Author: ruz
Date: Tue Nov 22 21:36:33 2005
New Revision: 4139
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/autohandler
Log:
r1350 at cubic-pc: cubic | 2005-11-23 05:40:07 +0300
* oops, last autohandler changes broke auth
Modified: rt/branches/3.7-EXPERIMENTAL/html/autohandler
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/autohandler (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/autohandler Tue Nov 22 21:36:33 2005
@@ -189,28 +189,35 @@
}
delete $session{'CurrentUser'}
- unless $session{'CurrentUser'} and $session{'CurrentUser'}->Id;
-
+ unless $session{'CurrentUser'} && $session{'CurrentUser'}->Id;
# Process per-page authentication callbacks
$m->comp('/Elements/Callback', %ARGS, _CallbackName => 'Auth');
-# If the user is logging in, let's authenticate
-if (!$session{'CurrentUser'} && defined $user && defined $pass ) {
- $session{'CurrentUser'} = RT::CurrentUser->new();
- $session{'CurrentUser'}->Load( $user );
-
- unless ( $session{'CurrentUser'}->id &&
- $session{'CurrentUser'}->IsPassword( $pass ) )
- {
- delete $session{'CurrentUser'};
- $RT::Logger->error("FAILED LOGIN for $user from $ENV{'REMOTE_ADDR'}");
- $m->comp('/Elements/Login', %ARGS,
- Error => loc('Your username or password is incorrect'));
+delete $session{'CurrentUser'}
+ unless $session{'CurrentUser'} && $session{'CurrentUser'}->Id;
+
+unless( $session{'CurrentUser'} ) {
+ # If the user is logging in, let's authenticate
+ if( defined $user && defined $pass ) {
+ my $user_obj = RT::CurrentUser->new;
+ $user_obj->Load( $user );
+
+ unless ( $user_obj->id && $user_obj->IsPassword( $pass ) ) {
+ $RT::Logger->error("FAILED LOGIN for $user from $ENV{'REMOTE_ADDR'}");
+ $m->comp( '/Elements/Login', %ARGS,
+ Error => loc('Your username or password is incorrect'),
+ );
+ $m->abort;
+ }
+ $session{'CurrentUser'} = $user_obj;
+ $RT::Logger->info("Successful login for $user from $ENV{'REMOTE_ADDR'}");
+ }
+ # if no credentials then show him login page
+ else {
+ $m->comp( '/Elements/Login', %ARGS );
$m->abort;
}
-
- $RT::Logger->info("Successful login for $user from $ENV{'REMOTE_ADDR'}");
}
# we've got credentials, let's serve the file up.
More information about the Rt-commit
mailing list