removed check_login from db mixin
This commit is contained in:
parent
ba016fda9a
commit
20583e8a4d
@ -34,7 +34,6 @@ import datetime
|
|||||||
from werkzeug.utils import cached_property
|
from werkzeug.utils import cached_property
|
||||||
|
|
||||||
from mediagoblin import mg_globals
|
from mediagoblin import mg_globals
|
||||||
from mediagoblin import auth
|
|
||||||
from mediagoblin.media_types import get_media_managers, FileTypeNotSupported
|
from mediagoblin.media_types import get_media_managers, FileTypeNotSupported
|
||||||
from mediagoblin.tools import common, licenses
|
from mediagoblin.tools import common, licenses
|
||||||
from mediagoblin.tools.text import cleaned_markdown_conversion
|
from mediagoblin.tools.text import cleaned_markdown_conversion
|
||||||
@ -42,12 +41,6 @@ from mediagoblin.tools.url import slugify
|
|||||||
|
|
||||||
|
|
||||||
class UserMixin(object):
|
class UserMixin(object):
|
||||||
def check_login(self, password):
|
|
||||||
"""
|
|
||||||
See if a user can login with this password
|
|
||||||
"""
|
|
||||||
return auth.check_login(self, password)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def bio_html(self):
|
def bio_html(self):
|
||||||
return cleaned_markdown_conversion(self.bio)
|
return cleaned_markdown_conversion(self.bio)
|
||||||
|
@ -19,6 +19,7 @@ import logging
|
|||||||
from werkzeug.exceptions import Unauthorized
|
from werkzeug.exceptions import Unauthorized
|
||||||
|
|
||||||
from mediagoblin.plugins.api.tools import Auth
|
from mediagoblin.plugins.api.tools import Auth
|
||||||
|
from mediagoblin.auth import check_login
|
||||||
|
|
||||||
_log = logging.getLogger(__name__)
|
_log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ class HTTPAuth(Auth):
|
|||||||
user = request.db.User.query.filter_by(
|
user = request.db.User.query.filter_by(
|
||||||
username=unicode(request.authorization['username'])).first()
|
username=unicode(request.authorization['username'])).first()
|
||||||
|
|
||||||
if user.check_login(request.authorization['password']):
|
if check_login(user, request.authorization['password']):
|
||||||
request.user = user
|
request.user = user
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -33,6 +33,7 @@ from mediagoblin.db.models import Collection
|
|||||||
from .tools import CmdTable, response_xml, check_form, \
|
from .tools import CmdTable, response_xml, check_form, \
|
||||||
PWGSession, PwgNamedArray, PwgError
|
PWGSession, PwgNamedArray, PwgError
|
||||||
from mediagoblin.plugins.basic_auth.lib import fake_login_attempt
|
from mediagoblin.plugins.basic_auth.lib import fake_login_attempt
|
||||||
|
from mediagoblin.auth import check_login
|
||||||
from .forms import AddSimpleForm, AddForm
|
from .forms import AddSimpleForm, AddForm
|
||||||
|
|
||||||
|
|
||||||
@ -48,7 +49,7 @@ def pwg_login(request):
|
|||||||
_log.info("User %r not found", username)
|
_log.info("User %r not found", username)
|
||||||
fake_login_attempt()
|
fake_login_attempt()
|
||||||
return PwgError(999, 'Invalid username/password')
|
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)
|
_log.warn("Wrong password for %r", username)
|
||||||
return PwgError(999, 'Invalid username/password')
|
return PwgError(999, 'Invalid username/password')
|
||||||
_log.info("Logging %r in", username)
|
_log.info("Logging %r in", username)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user