Browse Source

[MIG] auth_totp: Upgrade to v10

* Rename manifest
* Change openerp references to odoo
* Bump version
* Add pyotp back to requirements
pull/703/head
Dave Lasley 8 years ago
parent
commit
1271eeca32
No known key found for this signature in database GPG Key ID: 7DDBA4BA81B934CF
  1. 2
      auth_totp/README.rst
  2. 2
      auth_totp/__manifest__.py
  3. 8
      auth_totp/controllers/main.py
  4. 2
      auth_totp/exceptions.py
  5. 4
      auth_totp/models/res_users.py
  6. 2
      auth_totp/models/res_users_authenticator.py
  7. 2
      auth_totp/models/res_users_device.py
  8. 10
      auth_totp/tests/test_main.py
  9. 6
      auth_totp/tests/test_res_users.py
  10. 4
      auth_totp/tests/test_res_users_authenticator.py
  11. 6
      auth_totp/tests/test_res_users_authenticator_create.py
  12. 4
      auth_totp/wizards/res_users_authenticator_create.py
  13. 1
      requirements.txt

2
auth_totp/README.rst

@ -38,7 +38,7 @@ Install and enjoy.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
:target: https://runbot.odoo-community.org/runbot/149/10.0
Known Issues / Roadmap
======================

2
auth_totp/__openerp__.py → auth_totp/__manifest__.py

@ -5,7 +5,7 @@
{
'name': 'MFA Support',
'summary': 'Allows users to enable MFA and add optional trusted devices',
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Extra Tools',
'website': 'https://laslabs.com/',
'author': 'LasLabs, Odoo Community Association (OCA)',

8
auth_totp/controllers/main.py

@ -5,10 +5,10 @@
from datetime import datetime, timedelta
import json
from werkzeug.contrib.securecookie import SecureCookie
from openerp import _, http, registry, SUPERUSER_ID
from openerp.api import Environment
from openerp.http import Response, request
from openerp.addons.web.controllers.main import Home
from odoo import _, http, registry, SUPERUSER_ID
from odoo.api import Environment
from odoo.http import Response, request
from odoo.addons.web.controllers.main import Home
from ..exceptions import MfaTokenInvalidError, MfaTokenExpiredError

2
auth_totp/exceptions.py

@ -2,7 +2,7 @@
# Copyright 2016-2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from openerp.exceptions import AccessDenied
from odoo.exceptions import AccessDenied
class MfaTokenError(AccessDenied):

4
auth_totp/models/res_users.py

@ -5,8 +5,8 @@
from datetime import datetime, timedelta
import random
import string
from openerp import _, api, fields, models
from openerp.exceptions import AccessDenied, ValidationError
from odoo import _, api, fields, models
from odoo.exceptions import AccessDenied, ValidationError
from ..exceptions import MfaTokenInvalidError, MfaTokenExpiredError

2
auth_totp/models/res_users_authenticator.py

@ -3,7 +3,7 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import logging
from openerp import _, api, fields, models
from odoo import _, api, fields, models
_logger = logging.getLogger(__name__)
try:

2
auth_totp/models/res_users_device.py

@ -2,7 +2,7 @@
# Copyright 2016-2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from openerp import fields, models
from odoo import fields, models
class ResUsersDevice(models.Model):

10
auth_totp/tests/test_main.py

@ -4,11 +4,11 @@
from datetime import datetime
import mock
from openerp.http import Response
from openerp.tests.common import TransactionCase
from odoo.http import Response
from odoo.tests.common import TransactionCase
from ..controllers.main import AuthTotp
CONTROLLER_PATH = 'openerp.addons.auth_totp.controllers.main'
CONTROLLER_PATH = 'odoo.addons.auth_totp.controllers.main'
REQUEST_PATH = CONTROLLER_PATH + '.request'
SUPER_PATH = CONTROLLER_PATH + '.Home.web_login'
JSON_PATH = CONTROLLER_PATH + '.JsonSecureCookie'
@ -16,7 +16,7 @@ ENVIRONMENT_PATH = CONTROLLER_PATH + '.Environment'
RESPONSE_PATH = CONTROLLER_PATH + '.Response'
DATETIME_PATH = CONTROLLER_PATH + '.datetime'
TRANSLATE_PATH_CONT = CONTROLLER_PATH + '._'
MODEL_PATH = 'openerp.addons.auth_totp.models.res_users'
MODEL_PATH = 'odoo.addons.auth_totp.models.res_users'
GENERATE_PATH = MODEL_PATH + '.ResUsers.generate_mfa_login_token'
VALIDATE_PATH = MODEL_PATH + '.ResUsers.validate_mfa_confirmation_code'
TRANSLATE_PATH_MOD = MODEL_PATH + '._'
@ -41,7 +41,7 @@ class TestAuthTotp(TransactionCase):
self.test_user.trusted_device_ids = None
# Needed when tests are run with no prior requests (e.g. on a new DB)
patcher = mock.patch('openerp.http.request')
patcher = mock.patch('odoo.http.request')
self.addCleanup(patcher.stop)
patcher.start()

6
auth_totp/tests/test_res_users.py

@ -5,8 +5,8 @@
from datetime import datetime
import mock
import string
from openerp.exceptions import ValidationError
from openerp.tests.common import TransactionCase
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
from ..exceptions import (
MfaTokenError,
MfaTokenInvalidError,
@ -14,7 +14,7 @@ from ..exceptions import (
)
from ..models.res_users_authenticator import ResUsersAuthenticator
DATETIME_PATH = 'openerp.addons.auth_totp.models.res_users.datetime'
DATETIME_PATH = 'odoo.addons.auth_totp.models.res_users.datetime'
class TestResUsers(TransactionCase):

4
auth_totp/tests/test_res_users_authenticator.py

@ -3,9 +3,9 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import mock
from openerp.tests.common import TransactionCase
from odoo.tests.common import TransactionCase
MOCK_PATH = 'openerp.addons.auth_totp.models.res_users_authenticator.pyotp'
MOCK_PATH = 'odoo.addons.auth_totp.models.res_users_authenticator.pyotp'
class TestResUsersAuthenticator(TransactionCase):

6
auth_totp/tests/test_res_users_authenticator_create.py

@ -3,12 +3,12 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import mock
from openerp.exceptions import ValidationError
from openerp.tests.common import TransactionCase
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
@mock.patch(
'openerp.addons.auth_totp.wizards.res_users_authenticator_create.pyotp'
'odoo.addons.auth_totp.wizards.res_users_authenticator_create.pyotp'
)
class TestResUsersAuthenticatorCreate(TransactionCase):

4
auth_totp/wizards/res_users_authenticator_create.py

@ -4,8 +4,8 @@
import logging
import urllib
from openerp import _, api, fields, models
from openerp.exceptions import ValidationError
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
_logger = logging.getLogger(__name__)
try:

1
requirements.txt

@ -3,6 +3,7 @@ unidecode
acme_tiny
IPy
validate_email
pyotp
pysftp
fdb
sqlalchemy
Loading…
Cancel
Save