From 404e797cd905a57e8cb0afff2a553edbd0bc706a Mon Sep 17 00:00:00 2001 From: Matt Wright Date: Tue, 14 Aug 2012 14:18:20 -0400 Subject: [PATCH] Add more test coverage --- flask_security/core.py | 16 +--------------- flask_security/views.py | 4 ++-- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/flask_security/core.py b/flask_security/core.py index 4c75ba7..349688c 100644 --- a/flask_security/core.py +++ b/flask_security/core.py @@ -237,9 +237,6 @@ class Security(object): state = self._get_state(app, datastore or self.datastore) - if not hasattr(app, 'extensions'): - app.extensions = {} - app.extensions['security'] = state return state @@ -314,12 +311,8 @@ class AuthenticationProvider(object): try: user = self._get_user(username_or_email) - except AttributeError, e: - self.auth_error("Could not find user datastore: %s" % e) - except exceptions.UserNotFoundError, e: + except exceptions.UserNotFoundError: raise exceptions.BadCredentialsError("Specified user does not exist") - except Exception, e: - self.auth_error('Unexpected authentication error: %s' % e) if requires_confirmation(user): raise exceptions.BadCredentialsError('Account requires confirmation') @@ -332,10 +325,3 @@ class AuthenticationProvider(object): # bad match raise exceptions.BadCredentialsError("Password does not match") - - def auth_error(self, msg): - """Sends an error log message and raises an authentication error. - - :param msg: An authentication error message""" - current_app.logger.error(msg) - raise exceptions.AuthenticationError(msg) diff --git a/flask_security/views.py b/flask_security/views.py index a0eb415..548f2bd 100644 --- a/flask_security/views.py +++ b/flask_security/views.py @@ -132,10 +132,10 @@ def register_user(): def send_confirmation(): - form = ResendConfirmationForm() + form = ResendConfirmationForm(csrf_enabled=not app.testing) if form.validate_on_submit(): - user = _datastore.find_user(email=form.email.data) + user = _datastore.find_user(**form.to_dict()) reset_confirmation_token(user)