Skip to content

Commit

Permalink
views: remove encrypt_password
Browse files Browse the repository at this point in the history
Signed-off-by: Ioannis Tsanaktsidis <ioannis.tsanaktsidis@cern.ch>
  • Loading branch information
ioannistsanaktsidis authored and drjova committed Aug 22, 2017
1 parent e4a426e commit c5410a8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import sphinx.environment


# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down
1 change: 0 additions & 1 deletion invenio_accounts_rest/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from .utils import deny_all


ACCOUNTS_REST_READ_ROLE_PERMISSION_FACTORY = deny_all
"""Default get role permission factory: reject any request."""

Expand Down
2 changes: 1 addition & 1 deletion invenio_accounts_rest/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
from flask import request
from invenio_rest.errors import FieldError, RESTValidationError
from jsonpatch import JsonPatchException, JsonPointerException, apply_patch
from .errors import PatchJSONFailureRESTError

from .errors import PatchJSONFailureRESTError

_fields_without_profile = set([
'email',
Expand Down
9 changes: 4 additions & 5 deletions invenio_accounts_rest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
from functools import wraps

from flask import Blueprint, abort, current_app, request, url_for
from flask_security.changeable import encrypt_password
from flask_security.signals import password_changed
from flask_security.utils import verify_password
from flask_security.utils import hash_password, verify_password
from invenio_accounts.models import Role, User, userrole
from invenio_db import db
from invenio_oauth2server import require_api_auth
Expand Down Expand Up @@ -405,7 +404,7 @@ def get(self, role):
total_query = db.session.query(
func.count(User.id)).join(userrole).filter_by(
role_id=role.id
)
)
if query_string is not None:
query_filter = User.email.like('%{}%'.format(query_string))
users_query = users_query.filter(query_filter)
Expand Down Expand Up @@ -596,7 +595,7 @@ def get(self, user):
total_query = db.session.query(
func.count(Role.id)).join(userrole).filter_by(
user_id=user.id
)
)
if query_string is not None:
query_filter = Role.name.like('%{}%'.format(query_string))
roles_query = roles_query.filter(query_filter)
Expand Down Expand Up @@ -697,7 +696,7 @@ def patch(self, user):
raise MissingOldPasswordError()
updated_password = data['password']
if verify_password(data['old_password'], user.password):
user.password = encrypt_password(updated_password)
user.password = hash_password(updated_password)
db.session.commit()
_datastore.put(user)
password_changed.send(current_app._get_current_object(),
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ all_files = 1

[bdist_wheel]
universal = 1

[pydocstyle]
add_ignore = D401
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
]

install_requires = [
'invenio-accounts>=1.0.0b1',
'invenio-accounts>=1.0.0b9',
'invenio-db>=1.0.0b3,<1.1.0',
'invenio-rest>=1.0.0a10',
'invenio-access>=1.0.0a11',
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from flask_breadcrumbs import Breadcrumbs
from flask_mail import Mail
from flask_menu import Menu
from flask_security.utils import encrypt_password
from flask_security.utils import hash_password
from invenio_access import InvenioAccess
from invenio_access.models import ActionUsers
from invenio_access.permissions import superuser_access
Expand Down Expand Up @@ -291,7 +291,7 @@ def users(app, db, roles_data, users_data, create_roles):
with db.session.begin_nested():

for user_key, user_data in iteritems(users_data):
user_data['password'] = encrypt_password(user_data['password'])
user_data['password'] = hash_password(user_data['password'])
user = ds.create_user(**user_data)
result[user_key] = user

Expand Down

0 comments on commit c5410a8

Please sign in to comment.