removed check_login from db mixin

This commit is contained in:
Rodney Ewing 2013-05-20 07:45:17 -07:00
parent ba016fda9a
commit 20583e8a4d
3 changed files with 4 additions and 9 deletions

View File

@ -34,7 +34,6 @@ import datetime
from werkzeug.utils import cached_property
from mediagoblin import mg_globals
from mediagoblin import auth
from mediagoblin.media_types import get_media_managers, FileTypeNotSupported
from mediagoblin.tools import common, licenses
from mediagoblin.tools.text import cleaned_markdown_conversion
@ -42,12 +41,6 @@ from mediagoblin.tools.url import slugify
class UserMixin(object):
def check_login(self, password):
"""
See if a user can login with this password
"""
return auth.check_login(self, password)
@property
def bio_html(self):
return cleaned_markdown_conversion(self.bio)

View File

@ -19,6 +19,7 @@ import logging
from werkzeug.exceptions import Unauthorized
from mediagoblin.plugins.api.tools import Auth
from mediagoblin.auth import check_login
_log = logging.getLogger(__name__)
@ -42,7 +43,7 @@ class HTTPAuth(Auth):
user = request.db.User.query.filter_by(
username=unicode(request.authorization['username'])).first()
if user.check_login(request.authorization['password']):
if check_login(user, request.authorization['password']):
request.user = user
return True
else:

View File

@ -33,6 +33,7 @@ from mediagoblin.db.models import Collection
from .tools import CmdTable, response_xml, check_form, \
PWGSession, PwgNamedArray, PwgError
from mediagoblin.plugins.basic_auth.lib import fake_login_attempt
from mediagoblin.auth import check_login
from .forms import AddSimpleForm, AddForm
@ -48,7 +49,7 @@ def pwg_login(request):
_log.info("User %r not found", username)
fake_login_attempt()
return PwgError(999, 'Invalid username/password')
if not user.check_login(password):
if not check_login(user, password):
_log.warn("Wrong password for %r", username)
return PwgError(999, 'Invalid username/password')
_log.info("Logging %r in", username)