Bugzilla – Attachment 77881 Details for
Bug 21233
Add Koha::Exceptions::Password class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21233: Add Koha::Exceptions::Password
Bug-21233-Add-KohaExceptionsPassword.patch (text/plain), 3.24 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-08-16 09:58:23 UTC
(
hide
)
Description:
Bug 21233: Add Koha::Exceptions::Password
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-08-16 09:58:23 UTC
Size:
3.24 KB
patch
obsolete
>From d28c320331fb17f8691cd81ec36f57f79e8619f8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 16 Aug 2018 06:56:30 -0300 >Subject: [PATCH] Bug 21233: Add Koha::Exceptions::Password > >This patch adds some exceptions that we need. To test: > >- Apply this patch >- Run: > $ kshell > k$ prove t/Koha/Exceptions.t >=> SUCCESS: Tests pass! >- Sign off! :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Exceptions/Password.pm | 92 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 92 insertions(+) > create mode 100644 Koha/Exceptions/Password.pm > >diff --git a/Koha/Exceptions/Password.pm b/Koha/Exceptions/Password.pm >new file mode 100644 >index 0000000000..bffafdbadd >--- /dev/null >+++ b/Koha/Exceptions/Password.pm >@@ -0,0 +1,92 @@ >+package Koha::Exceptions::Password; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Exception::Class ( >+ >+ 'Koha::Exceptions::Password' => { >+ description => 'Something went wrong!', >+ }, >+ 'Koha::Exceptions::Password::Invalid' => { >+ isa => 'Koha::Exceptions::Password', >+ description => 'Invalid password' >+ }, >+ 'Koha::Exceptions::Password::TooShort' => { >+ isa => 'Koha::Exceptions::Password', >+ description => 'Password is too short', >+ fields => ['length','min_length'] >+ }, >+ 'Koha::Exceptions::Password::TooWeak' => { >+ isa => 'Koha::Exceptions::Password', >+ description => 'Password is too weak' >+ }, >+ 'Koha::Exceptions::Password::TrailingWhitespaces' => { >+ isa => 'Koha::Exceptions::Password', >+ description => 'Password contains trailing whitespace(s)' >+ } >+); >+ >+sub full_message { >+ my $self = shift; >+ >+ my $msg = $self->message; >+ >+ unless ( $msg) { >+ if ( $self->isa('Koha::Exceptions::Password::TooShort') ) { >+ $msg = sprintf("Password length (%s) is shorter than required (%s)", $self->length, $self->min_length ); >+ } >+ } >+ >+ return $msg; >+} >+ >+=head1 NAME >+ >+Koha::Exceptions::Password - Base class for password exceptions >+ >+=head1 Exceptions >+ >+=head2 Koha::Exceptions::Password >+ >+Generic password exception >+ >+=head2 Koha::Exceptions::Password::Invalid >+ >+The supplied password is invalid. >+ >+=head2 Koha::Exceptions::Password::TooShort >+ >+Password is too short. >+ >+=head2 Koha::Exceptions::Password::TooWeak >+ >+Password is too weak. >+ >+=head2 Koha::Exceptions::Password::TrailingWhitespaces >+ >+Password contains trailing spaces, which is forbidden. >+ >+=head1 Class methods >+ >+=head2 full_message >+ >+Overloaded method for exception stringifying. >+ >+=cut >+ >+1; >-- >2.18.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21233
:
77880
|
77881
|
77914
|
77915
|
78116
|
78117
|
78118
|
78721
|
78836