added friendly exception for handling invalid usernames
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Jul 2005 14:31:24 +0000 (14:31 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 5 Jul 2005 14:31:24 +0000 (14:31 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1034 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Auth.pm
Open-ILS/src/perlmods/OpenILS/EX.pm
Open-ILS/src/templates/strings/ex.ttk

index 5f1bed2..2d84b87 100644 (file)
@@ -10,6 +10,7 @@ use OpenSRF::EX qw(:try);
 use OpenILS::Application::AppUtils;
 use OpenILS::Perm;
 use OpenILS::Application::AppUtils;
+use OpenILS::EX;
 
 # memcache handle
 my $cache_handle;
@@ -111,8 +112,7 @@ sub complete_authenticate {
                        "open-ils.storage", $name, $username );
 
        unless(ref($user_list)) {
-               throw OpenSRF::EX::ERROR 
-                       ("No user info returned from storage for $username");
+               return OpenILS::EX->new("UNKNOWN_USER")->ex;
        }
 
        warn "We have the user from storage with usrname $username\n";
@@ -121,7 +121,7 @@ sub complete_authenticate {
        
 
        if(!$user or !ref($user) ) {
-               throw OpenSRF::EX::ERROR ("No user for $username");
+               return OpenILS::EX->new("UNKNOWN_USER")->ex();
        }
 
        my $password = $user->passwd();
index 12c7478..5be7f66 100644 (file)
@@ -16,6 +16,7 @@ my %ex_types = (
        DUPLICATE_USER_USERNAME                         => 5,
        USER_WRONG_PASSWORD                                     => 6,
        PERMISSION_DENIED                                               => 7,
+       UNKNOWN_USER                                                    => 8, 
 );
 
 use overload ( '""' => sub { $_[0]->ex()->err_msg(); } );
index 5ab1649..2f29a68 100644 (file)
@@ -33,4 +33,9 @@
        IF type == ex_types.USER_WRONG_PASSWORD;
                ret("Password is incorrect");   END;
 
+       IF type == ex_types.UNKNOWN_USER;
+               ret("User is not recognized"); END;
+
+       ret("Unknown exception occured");
+
 -%]