From 073f18593c089649a8cd8c2233e2cd0d8249b7d6 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 5 Jul 2005 14:31:24 +0000 Subject: [PATCH] added friendly exception for handling invalid usernames git-svn-id: svn://svn.open-ils.org/ILS/trunk@1034 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Auth.pm | 6 +++--- Open-ILS/src/perlmods/OpenILS/EX.pm | 1 + Open-ILS/src/templates/strings/ex.ttk | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Auth.pm b/Open-ILS/src/perlmods/OpenILS/Application/Auth.pm index 5f1bed200c..2d84b873a3 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Auth.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Auth.pm @@ -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(); diff --git a/Open-ILS/src/perlmods/OpenILS/EX.pm b/Open-ILS/src/perlmods/OpenILS/EX.pm index 12c74787e1..5be7f66ac9 100644 --- a/Open-ILS/src/perlmods/OpenILS/EX.pm +++ b/Open-ILS/src/perlmods/OpenILS/EX.pm @@ -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(); } ); diff --git a/Open-ILS/src/templates/strings/ex.ttk b/Open-ILS/src/templates/strings/ex.ttk index 5ab1649736..2f29a68978 100644 --- a/Open-ILS/src/templates/strings/ex.ttk +++ b/Open-ILS/src/templates/strings/ex.ttk @@ -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"); + -%] -- 2.43.2