aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/auth/__init__.py7
-rw-r--r--mediagoblin/auth/tools.py1
-rw-r--r--mediagoblin/plugins/basic_auth/__init__.py15
-rw-r--r--mediagoblin/tests/test_auth.py5
4 files changed, 6 insertions, 22 deletions
diff --git a/mediagoblin/auth/__init__.py b/mediagoblin/auth/__init__.py
index ae6c4b96..8cb1f401 100644
--- a/mediagoblin/auth/__init__.py
+++ b/mediagoblin/auth/__init__.py
@@ -16,13 +16,6 @@
from mediagoblin.tools.pluginapi import hook_handle, hook_runall
-def check_login(user, password):
- result = hook_handle("auth_check_login", user, password)
- if result:
- return result
- return False
-
-
def get_user(username):
return hook_handle("auth_get_user", username)
diff --git a/mediagoblin/auth/tools.py b/mediagoblin/auth/tools.py
index db1a6297..484c3030 100644
--- a/mediagoblin/auth/tools.py
+++ b/mediagoblin/auth/tools.py
@@ -17,7 +17,6 @@
import logging
import wtforms
-from sqlalchemy import or_
from mediagoblin import mg_globals
from mediagoblin.db.models import User
diff --git a/mediagoblin/plugins/basic_auth/__init__.py b/mediagoblin/plugins/basic_auth/__init__.py
index fe314504..375af335 100644
--- a/mediagoblin/plugins/basic_auth/__init__.py
+++ b/mediagoblin/plugins/basic_auth/__init__.py
@@ -26,14 +26,6 @@ def setup_plugin():
config = pluginapi.get_config('mediagoblin.pluginapi.basic_auth')
-def check_login(user, password):
- if user.pw_hash:
- result = check_password(password, user.pw_hash)
- if result:
- return result
- return None
-
-
def get_user(username):
user = User.query.filter(
or_(
@@ -49,7 +41,7 @@ def create_user(registration_form):
user = User()
user.username = registration_form.username.data
user.email = registration_form.email.data
- user.pw_hash = igen_password_hash(
+ user.pw_hash = gen_password_hash(
registration_form.password.data)
user.verification_key = unicode(uuid.uuid4())
user.save()
@@ -64,11 +56,11 @@ def get_registration_form(request):
return auth_forms.RegistrationForm(request.form)
-def gen_password_hash(raw_pass, extra_salt):
+def gen_password_hash(raw_pass, extra_salt=None):
return auth_tools.bcrypt_gen_password_hash(raw_pass, extra_salt)
-def check_password(raw_pass, stored_hash, extra_salt):
+def check_password(raw_pass, stored_hash, extra_salt=None):
return auth_tools.bcrypt_check_password(raw_pass, stored_hash, extra_salt)
@@ -89,7 +81,6 @@ def add_to_form_context(context):
hooks = {
'setup': setup_plugin,
'authentication': auth,
- 'auth_check_login': check_login,
'auth_get_user': get_user,
'auth_create_user': create_user,
'auth_get_login_form': get_login_form,
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index ee916c43..8a828303 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -23,6 +23,7 @@ from mediagoblin.db.models import User
from mediagoblin.tests.tools import get_app, fixture_add_user
from mediagoblin.tools import template, mail
from mediagoblin.auth.tools import AuthError
+from mediagoblin.auth import tools as auth_tools
from mediagoblin import auth
@@ -404,8 +405,8 @@ def test_no_auth_true_no_auth_plugin_app(no_auth_true_no_auth_plugin_app):
assert urlparse.urlsplit(response.location)[2] == '/'
assert 'mediagoblin/root.html' in template.TEMPLATE_TEST_CONTEXT
- ## Test check_login should return False
- assert auth.check_login('test', 'simple') is False
+ ## Test check_login_simple should return None
+ assert auth_tools.check_login_simple('test', 'simple') is None
# Try to visit the forgot password page
template.clear_test_template_context()