Skip to content

Commit e44bab0

Browse files
authored
Make error messages overridable by providers (#112)
1 parent d34007c commit e44bab0

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
Version 0.10
5+
------------
6+
7+
- Allow overriding the message of ``NoSuchUser`` and ``InvalidCredentials``, and
8+
make its other arguments keyword-only
9+
410
Version 0.9
511
-----------
612

flask_multipass/exceptions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ class AuthenticationFailed(MultipassException):
2525
class NoSuchUser(AuthenticationFailed):
2626
"""Indicates a user does not exist when attempting to authenticate."""
2727

28-
def __init__(self, details=None, provider=None, identifier=None):
29-
AuthenticationFailed.__init__(self, 'No such user', details=details, provider=provider)
28+
def __init__(self, message='No such user', *, details=None, provider=None, identifier=None):
29+
AuthenticationFailed.__init__(self, message, details=details, provider=provider)
3030
self.identifier = identifier
3131

3232

3333
class InvalidCredentials(AuthenticationFailed):
3434
"""Indicates a failure to authenticate using the given credentials."""
3535

36-
def __init__(self, details=None, provider=None, identifier=None):
37-
AuthenticationFailed.__init__(self, 'Invalid credentials', details=details, provider=provider)
36+
def __init__(self, message='Invalid credentials', *, details=None, provider=None, identifier=None):
37+
AuthenticationFailed.__init__(self, message, details=details, provider=provider)
3838
self.identifier = identifier
3939

4040

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = 'Flask-Multipass'
3-
version = '0.9'
3+
version = '0.10'
44
description = 'A pluggable solution for multi-backend authentication with Flask'
55
readme = 'README.rst'
66
license = 'BSD-3-Clause'

0 commit comments

Comments
 (0)