pyramid-fullauth 0.3.2__py2.7.egg → 0.6.0__py2.7.egg
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- EGG-INFO/PKG-INFO +53 -11
- EGG-INFO/SOURCES.txt +4 -0
- EGG-INFO/requires.txt +11 -10
- pyramid_fullauth/__init__.py +4 -4
- pyramid_fullauth/__init__.pyc +0 -0
- pyramid_fullauth/auth.py +5 -4
- pyramid_fullauth/auth.pyc +0 -0
- pyramid_fullauth/compat.py +20 -0
- pyramid_fullauth/compat.pyc +0 -0
- pyramid_fullauth/config/default.yaml +1 -1
- pyramid_fullauth/events.py +1 -20
- pyramid_fullauth/events.pyc +0 -0
- pyramid_fullauth/exceptions.py +1 -7
- pyramid_fullauth/exceptions.pyc +0 -0
- pyramid_fullauth/models/__init__.py +7 -8
- pyramid_fullauth/models/__init__.pyc +0 -0
- pyramid_fullauth/models/extensions/__init__.py +38 -0
- pyramid_fullauth/models/extensions/__init__.pyc +0 -0
- pyramid_fullauth/models/mixins/__init__.py +3 -2
- pyramid_fullauth/models/mixins/__init__.pyc +0 -0
- pyramid_fullauth/models/mixins/email.py +58 -10
- pyramid_fullauth/models/mixins/email.pyc +0 -0
- pyramid_fullauth/models/mixins/password.py +5 -11
- pyramid_fullauth/models/mixins/password.pyc +0 -0
- pyramid_fullauth/request.py +6 -5
- pyramid_fullauth/request.pyc +0 -0
- pyramid_fullauth/resources/helpers/social.mako +3 -3
- pyramid_fullauth/resources/locale/pyramid_fullauth.pot +23 -23
- pyramid_fullauth/resources/templates/403.mako +1 -1
- pyramid_fullauth/resources/templates/_form.login.mako +1 -1
- pyramid_fullauth/resources/templates/_form.register.mako +1 -1
- pyramid_fullauth/resources/templates/_social.login.mako +1 -1
- pyramid_fullauth/resources/templates/activate.mako +1 -1
- pyramid_fullauth/resources/templates/email_change.mako +1 -1
- pyramid_fullauth/resources/templates/layout.mako +1 -1
- pyramid_fullauth/resources/templates/login.mako +1 -1
- pyramid_fullauth/resources/templates/register.mako +1 -1
- pyramid_fullauth/resources/templates/reset.mako +1 -1
- pyramid_fullauth/resources/templates/reset.proceed.mako +1 -1
- pyramid_fullauth/routing/__init__.py +1 -1
- pyramid_fullauth/routing/__init__.pyc +0 -0
- pyramid_fullauth/routing/predicates.py +4 -3
- pyramid_fullauth/routing/predicates.pyc +0 -0
- pyramid_fullauth/tools.py +7 -4
- pyramid_fullauth/tools.pyc +0 -0
- pyramid_fullauth/views/__init__.py +2 -3
- pyramid_fullauth/views/__init__.pyc +0 -0
- pyramid_fullauth/views/basic/__init__.py +1 -1
- pyramid_fullauth/views/basic/__init__.pyc +0 -0
- pyramid_fullauth/views/basic/activate.py +1 -2
- pyramid_fullauth/views/basic/activate.pyc +0 -0
- pyramid_fullauth/views/basic/forbidden.py +3 -5
- pyramid_fullauth/views/basic/forbidden.pyc +0 -0
- pyramid_fullauth/views/basic/login.py +28 -34
- pyramid_fullauth/views/basic/login.pyc +0 -0
- pyramid_fullauth/views/basic/logout.py +1 -2
- pyramid_fullauth/views/basic/logout.pyc +0 -0
- pyramid_fullauth/views/basic/profile/__init__.py +1 -1
- pyramid_fullauth/views/basic/profile/__init__.pyc +0 -0
- pyramid_fullauth/views/basic/profile/email.py +44 -37
- pyramid_fullauth/views/basic/profile/email.pyc +0 -0
- pyramid_fullauth/views/basic/profile/password.py +6 -7
- pyramid_fullauth/views/basic/profile/password.pyc +0 -0
- pyramid_fullauth/views/basic/register.py +53 -27
- pyramid_fullauth/views/basic/register.pyc +0 -0
- pyramid_fullauth/views/social.py +7 -5
- pyramid_fullauth/views/social.pyc +0 -0
- tests/__init__.pyc +0 -0
- tests/conftest.py +23 -10
- tests/conftest.pyc +0 -0
- tests/tools.pyc +0 -0
- tests/unit/test_default_settings.pyc +0 -0
- tests/unit/test_groupfinder.pyc +0 -0
- tests/unit/test_social_view.py +28 -26
- tests/unit/test_social_view.pyc +0 -0
- tests/unit/test_tools.pyc +0 -0
- tests/unit/test_user_active.pyc +0 -0
- tests/unit/test_user_admin.pyc +0 -0
- tests/unit/test_user_email.pyc +0 -0
- tests/unit/test_user_password.py +1 -1
- tests/unit/test_user_password.pyc +0 -0
- tests/unit/test_user_providers.pyc +0 -0
- tests/unit/test_user_repr.py +4 -4
- tests/unit/test_user_repr.pyc +0 -0
- tests/unit/test_validators.py +1 -1
- tests/unit/test_validators.pyc +0 -0
- tests/views/__init__.pyc +0 -0
- tests/views/conftest.py +5 -0
- tests/views/conftest.pyc +0 -0
- tests/views/test_activation.py +13 -6
- tests/views/test_activation.pyc +0 -0
- tests/views/test_email.py +2 -2
- tests/views/test_email.pyc +0 -0
- tests/views/test_events.py +107 -49
- tests/views/test_events.pyc +0 -0
- tests/views/test_login.py +23 -2
- tests/views/test_login.pyc +0 -0
- tests/views/test_login_social.py +97 -69
- tests/views/test_login_social.pyc +0 -0
- tests/views/test_logout.pyc +0 -0
- tests/views/test_register.py +9 -5
- tests/views/test_register.pyc +0 -0
- tests/views/test_reset.py +9 -4
- tests/views/test_reset.pyc +0 -0
EGG-INFO/PKG-INFO
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: pyramid-fullauth
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: This package intends to provide full authentication / authorisation
|
|
5
5
|
implementation for pyramid applications
|
|
6
6
|
Home-page: https://github.com/fizyk/pyramid_fullauth
|
|
@@ -14,6 +14,10 @@ Description: pyramid_fullauth
|
|
|
14
14
|
:target: https://pypi.python.org/pypi/pyramid_fullauth/
|
|
15
15
|
:alt: Latest PyPI version
|
|
16
16
|
|
|
17
|
+
.. image:: https://readthedocs.org/projects/pyramid_fullauth/badge/?version=v0.6.0
|
|
18
|
+
:target: https://readthedocs.org/projects/pyramid_fullauth/?badge=v0.6.0
|
|
19
|
+
:alt: Documentation Status
|
|
20
|
+
|
|
17
21
|
.. image:: https://pypip.in/d/pyramid_fullauth/badge.png
|
|
18
22
|
:target: https://pypi.python.org/pypi/pyramid_fullauth/
|
|
19
23
|
:alt: Number of PyPI downloads
|
|
@@ -30,22 +34,23 @@ Description: pyramid_fullauth
|
|
|
30
34
|
:target: https://pypi.python.org/pypi/pyramid_fullauth/
|
|
31
35
|
:alt: License
|
|
32
36
|
|
|
33
|
-
Pyramid fullauth's
|
|
37
|
+
Pyramid fullauth's provides full user registration and management functionality for
|
|
38
|
+
`pyramid <http://docs.pylonsproject.org/en/latest/docs/pyramid.html>`_ based web applications.
|
|
34
39
|
|
|
35
40
|
Package status
|
|
36
41
|
--------------
|
|
37
42
|
|
|
38
|
-
.. image:: https://travis-ci.org/fizyk/pyramid_fullauth.png?branch=
|
|
43
|
+
.. image:: https://travis-ci.org/fizyk/pyramid_fullauth.png?branch=v0.6.0
|
|
39
44
|
:target: https://travis-ci.org/fizyk/pyramid_fullauth
|
|
40
45
|
:alt: Tests
|
|
41
46
|
|
|
42
|
-
.. image:: https://coveralls.io/repos/fizyk/pyramid_fullauth/badge.png?branch=
|
|
43
|
-
:target: https://coveralls.io/r/fizyk/pyramid_fullauth?branch=
|
|
47
|
+
.. image:: https://coveralls.io/repos/fizyk/pyramid_fullauth/badge.png?branch=v0.6.0
|
|
48
|
+
:target: https://coveralls.io/r/fizyk/pyramid_fullauth?branch=v0.6.0
|
|
44
49
|
:alt: Coverage Status
|
|
45
50
|
|
|
46
|
-
.. image:: https://requires.io/github/fizyk/pyramid_fullauth/requirements.
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
.. image:: https://requires.io/github/fizyk/pyramid_fullauth/requirements.svg?tag=v0.6.0
|
|
52
|
+
:target: https://requires.io/github/fizyk/pyramid_fullauth/requirements/?tag=v0.6.0
|
|
53
|
+
:alt: Requirements Status
|
|
49
54
|
|
|
50
55
|
Package resources
|
|
51
56
|
-----------------
|
|
@@ -54,8 +59,8 @@ Description: pyramid_fullauth
|
|
|
54
59
|
* Documentation: http://pyramid-fullauth.readthedocs.org/
|
|
55
60
|
* PyPI: https://pypi.python.org/pypi/pyramid_fullauth
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
Installation
|
|
63
|
+
------------
|
|
59
64
|
|
|
60
65
|
``pip install pyramid_fullauth``
|
|
61
66
|
|
|
@@ -73,6 +78,38 @@ Description: pyramid_fullauth
|
|
|
73
78
|
CHANGELOG
|
|
74
79
|
=========
|
|
75
80
|
|
|
81
|
+
0.6.0
|
|
82
|
+
-------
|
|
83
|
+
|
|
84
|
+
- increased the size of password and salt fields to 128 characters each
|
|
85
|
+
- default password hashing algorithm is sha256
|
|
86
|
+
|
|
87
|
+
0.5.0
|
|
88
|
+
-------
|
|
89
|
+
|
|
90
|
+
- full python3 compatibility, since velruse migrated to py3 enabled requests-oauth
|
|
91
|
+
- require velruse 1.1.1
|
|
92
|
+
- run tests with sqlalchemy 1.0.x
|
|
93
|
+
- small updates to conform with new linters versions embedded in pylama
|
|
94
|
+
|
|
95
|
+
0.4.1
|
|
96
|
+
-------
|
|
97
|
+
|
|
98
|
+
- fixed spelling for error message when user does not exist while trying to reset password.
|
|
99
|
+
- require pyramid_basemodel at least version 0.3
|
|
100
|
+
|
|
101
|
+
0.4.0
|
|
102
|
+
-------
|
|
103
|
+
|
|
104
|
+
- python 3 compatibility (without oauth2 though)
|
|
105
|
+
- cleared use of deprecated function `pyramid.security.authenticated_userid` in favour of `pyramid.request.Request.authenticated_userid` attribute.
|
|
106
|
+
- make email fields case insensitive by using hybrid properties and CaseInsensitive comparator for model.
|
|
107
|
+
|
|
108
|
+
0.3.3
|
|
109
|
+
-------
|
|
110
|
+
|
|
111
|
+
- Fix issue where groupfined was returning empty list instead of None when user did not existed
|
|
112
|
+
|
|
76
113
|
0.3.2
|
|
77
114
|
-----
|
|
78
115
|
|
|
@@ -166,6 +203,11 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
166
203
|
Classifier: Natural Language :: English
|
|
167
204
|
Classifier: Operating System :: OS Independent
|
|
168
205
|
Classifier: Programming Language :: Python
|
|
169
|
-
Classifier: Programming Language :: Python :: 2
|
|
206
|
+
Classifier: Programming Language :: Python :: 2
|
|
170
207
|
Classifier: Programming Language :: Python :: 2.7
|
|
208
|
+
Classifier: Programming Language :: Python :: 3
|
|
209
|
+
Classifier: Programming Language :: Python :: 3.3
|
|
210
|
+
Classifier: Programming Language :: Python :: 3.4
|
|
211
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
212
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
171
213
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
EGG-INFO/SOURCES.txt
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
AUTHORS.rst
|
|
2
2
|
CHANGES.rst
|
|
3
|
+
CONTRIBUTING.rst
|
|
3
4
|
MANIFEST.in
|
|
4
5
|
README.rst
|
|
5
6
|
setup.cfg
|
|
@@ -12,6 +13,7 @@ docs/source/authors.rst
|
|
|
12
13
|
docs/source/basic.rst
|
|
13
14
|
docs/source/changelog.rst
|
|
14
15
|
docs/source/conf.py
|
|
16
|
+
docs/source/contributing.rst
|
|
15
17
|
docs/source/customise.rst
|
|
16
18
|
docs/source/index.rst
|
|
17
19
|
docs/source/narrative.rst
|
|
@@ -25,6 +27,7 @@ docs/source/api/request.rst
|
|
|
25
27
|
docs/source/api/tools.rst
|
|
26
28
|
pyramid_fullauth/__init__.py
|
|
27
29
|
pyramid_fullauth/auth.py
|
|
30
|
+
pyramid_fullauth/compat.py
|
|
28
31
|
pyramid_fullauth/events.py
|
|
29
32
|
pyramid_fullauth/exceptions.py
|
|
30
33
|
pyramid_fullauth/request.py
|
|
@@ -37,6 +40,7 @@ pyramid_fullauth.egg-info/requires.txt
|
|
|
37
40
|
pyramid_fullauth.egg-info/top_level.txt
|
|
38
41
|
pyramid_fullauth/config/default.yaml
|
|
39
42
|
pyramid_fullauth/models/__init__.py
|
|
43
|
+
pyramid_fullauth/models/extensions/__init__.py
|
|
40
44
|
pyramid_fullauth/models/mixins/__init__.py
|
|
41
45
|
pyramid_fullauth/models/mixins/email.py
|
|
42
46
|
pyramid_fullauth/models/mixins/password.py
|
EGG-INFO/requires.txt
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
pyramid_localize
|
|
2
|
-
pyramid
|
|
2
|
+
pyramid>=1.4
|
|
3
3
|
pyramid_mako
|
|
4
|
-
tzf.pyramid_yml
|
|
5
|
-
pyramid_basemodel
|
|
6
|
-
|
|
4
|
+
tzf.pyramid_yml>=1.0
|
|
5
|
+
pyramid_basemodel>=0.3
|
|
6
|
+
SQLAlchemy!=1.1.0,!=1.1.1
|
|
7
|
+
velruse >=1.1.1
|
|
7
8
|
|
|
8
9
|
[docs]
|
|
9
10
|
sphinx
|
|
10
11
|
|
|
11
12
|
[tests]
|
|
12
|
-
mock
|
|
13
|
-
|
|
14
|
-
pytest-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
pytest-
|
|
13
|
+
mock==2.0.0
|
|
14
|
+
pytest==3.0.6
|
|
15
|
+
pytest-pyramid==0.3.0
|
|
16
|
+
pytest-cov==2.4.0
|
|
17
|
+
pytest-mysql==1.1.0
|
|
18
|
+
pytest-postgresql==1.2.0
|
pyramid_fullauth/__init__.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
# Copyright (c) 2013 -
|
|
1
|
+
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
2
2
|
#
|
|
3
3
|
# This module is part of pyramid_fullauth and is released under
|
|
4
4
|
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
5
5
|
"""Fullauth's configuration module."""
|
|
6
|
-
|
|
7
6
|
import logging
|
|
8
7
|
|
|
9
8
|
from tzf.pyramid_yml import config_defaults
|
|
@@ -17,7 +16,7 @@ from pyramid_fullauth.auth import groupfinder
|
|
|
17
16
|
from pyramid_fullauth.routing import predicates
|
|
18
17
|
from pyramid_fullauth.request import login_perform, logout, user
|
|
19
18
|
|
|
20
|
-
__version__ = '0.
|
|
19
|
+
__version__ = '0.6.0'
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
logger = logging.getLogger(__name__)
|
|
@@ -82,7 +81,8 @@ def includeme(configurator):
|
|
|
82
81
|
# scan base views
|
|
83
82
|
configurator.scan('pyramid_fullauth.views.basic')
|
|
84
83
|
|
|
85
|
-
# check for the social.
|
|
84
|
+
# check for the social.
|
|
85
|
+
# If social is not available, we will not turn it on!
|
|
86
86
|
if 'social' in fullauth_config:
|
|
87
87
|
# Velruse init (for social auth)
|
|
88
88
|
|
pyramid_fullauth/__init__.pyc
CHANGED
|
Binary file
|
pyramid_fullauth/auth.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013 -
|
|
1
|
+
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
2
2
|
#
|
|
3
3
|
# This module is part of pyramid_fullauth and is released under
|
|
4
4
|
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
@@ -16,7 +16,8 @@ def groupfinder(userid, request):
|
|
|
16
16
|
Adds **s:inactive** group to users who has not activated their account, and **s:user** group to those, who did.
|
|
17
17
|
If user has is_admin flag, he gets **s:superadmin** group set
|
|
18
18
|
|
|
19
|
-
Might be useful, when you want restrict access to some parts of your application, but still allow log in, and
|
|
19
|
+
Might be useful, when you want restrict access to some parts of your application, but still allow log in, and
|
|
20
|
+
access to some other parts.
|
|
20
21
|
|
|
21
22
|
:param int userid: user identity
|
|
22
23
|
:param pyramid.request.Request request: request object
|
|
@@ -38,11 +39,11 @@ def groupfinder(userid, request):
|
|
|
38
39
|
else:
|
|
39
40
|
groups.append('s:inactive')
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
return groups
|
|
43
|
+
return None
|
|
42
44
|
|
|
43
45
|
|
|
44
46
|
class BaseACLRootFactoryMixin(object):
|
|
45
|
-
|
|
46
47
|
"""
|
|
47
48
|
ACL list factory Mixin.
|
|
48
49
|
|
pyramid_fullauth/auth.pyc
CHANGED
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
# Copyright (c) 2013 - 2015 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
3
|
+
#
|
|
4
|
+
# This module is part of pyramid_fullauth and is released under
|
|
5
|
+
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
6
|
+
"""pyramid_fullauth's compatibility file for python2 and 3."""
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
if sys.version_info.major == 2:
|
|
12
|
+
from urllib import urlencode
|
|
13
|
+
from urlparse import urlparse, parse_qs
|
|
14
|
+
from hashlib import algorithms
|
|
15
|
+
else:
|
|
16
|
+
from urllib.parse import urlencode, urlparse, parse_qs
|
|
17
|
+
from hashlib import algorithms_guaranteed as algorithms
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__all__ = ('urlencode', 'urlparse', 'parse_qs', 'algorithms')
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013 -
|
|
1
|
+
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
2
2
|
#
|
|
3
3
|
# This module is part of pyramid_fullauth and is released under
|
|
4
4
|
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
pyramid_fullauth/events.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013 -
|
|
1
|
+
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
2
2
|
#
|
|
3
3
|
# This module is part of pyramid_fullauth and is released under
|
|
4
4
|
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class _BaseRegisterEvent(object):
|
|
10
|
-
|
|
11
10
|
"""
|
|
12
11
|
Base fullauth event.
|
|
13
12
|
|
|
@@ -27,7 +26,6 @@ class _BaseRegisterEvent(object):
|
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
class BeforeRegister(_BaseRegisterEvent):
|
|
30
|
-
|
|
31
29
|
"""
|
|
32
30
|
Execute custom code at the start of registration process.
|
|
33
31
|
|
|
@@ -50,7 +48,6 @@ class BeforeRegister(_BaseRegisterEvent):
|
|
|
50
48
|
|
|
51
49
|
|
|
52
50
|
class AfterRegister(_BaseRegisterEvent):
|
|
53
|
-
|
|
54
51
|
"""
|
|
55
52
|
Add custom post-processing code in registration process.
|
|
56
53
|
|
|
@@ -82,7 +79,6 @@ class AfterRegister(_BaseRegisterEvent):
|
|
|
82
79
|
|
|
83
80
|
|
|
84
81
|
class AfterActivate(_BaseRegisterEvent):
|
|
85
|
-
|
|
86
82
|
"""
|
|
87
83
|
Add custom post-processing logic after user gets activated.
|
|
88
84
|
|
|
@@ -95,7 +91,6 @@ class AfterActivate(_BaseRegisterEvent):
|
|
|
95
91
|
|
|
96
92
|
|
|
97
93
|
class AfterResetRequest(_BaseRegisterEvent):
|
|
98
|
-
|
|
99
94
|
"""
|
|
100
95
|
Add custom post-processing after user sends request to reset password.
|
|
101
96
|
|
|
@@ -108,14 +103,12 @@ class AfterResetRequest(_BaseRegisterEvent):
|
|
|
108
103
|
|
|
109
104
|
|
|
110
105
|
class BeforeReset(_BaseRegisterEvent):
|
|
111
|
-
|
|
112
106
|
"""Add custom pre-processing before the actual reset-password process."""
|
|
113
107
|
|
|
114
108
|
pass
|
|
115
109
|
|
|
116
110
|
|
|
117
111
|
class AfterReset(_BaseRegisterEvent):
|
|
118
|
-
|
|
119
112
|
"""
|
|
120
113
|
Add custom post-processing after the actual reset-password process.
|
|
121
114
|
|
|
@@ -128,7 +121,6 @@ class AfterReset(_BaseRegisterEvent):
|
|
|
128
121
|
|
|
129
122
|
|
|
130
123
|
class AlreadyLoggedIn(object):
|
|
131
|
-
|
|
132
124
|
"""
|
|
133
125
|
Allow execute custom logic, when logged in user tries to log in again.
|
|
134
126
|
|
|
@@ -148,7 +140,6 @@ class AlreadyLoggedIn(object):
|
|
|
148
140
|
|
|
149
141
|
|
|
150
142
|
class BeforeLogIn(_BaseRegisterEvent):
|
|
151
|
-
|
|
152
143
|
"""
|
|
153
144
|
Add custom logic before user gets logged in.
|
|
154
145
|
|
|
@@ -162,7 +153,6 @@ class BeforeLogIn(_BaseRegisterEvent):
|
|
|
162
153
|
|
|
163
154
|
|
|
164
155
|
class AfterLogIn(_BaseRegisterEvent):
|
|
165
|
-
|
|
166
156
|
"""Add custom logic after user logs in."""
|
|
167
157
|
|
|
168
158
|
pass
|
|
@@ -173,7 +163,6 @@ class AfterLogIn(_BaseRegisterEvent):
|
|
|
173
163
|
|
|
174
164
|
|
|
175
165
|
class _BaseSocialRegister(_BaseRegisterEvent):
|
|
176
|
-
|
|
177
166
|
"""Base for all social requests."""
|
|
178
167
|
|
|
179
168
|
def __init__(self, request, user, profile):
|
|
@@ -189,14 +178,12 @@ class _BaseSocialRegister(_BaseRegisterEvent):
|
|
|
189
178
|
|
|
190
179
|
|
|
191
180
|
class BeforeSocialRegister(_BaseSocialRegister):
|
|
192
|
-
|
|
193
181
|
"""Adds custom logic before the social login process start."""
|
|
194
182
|
|
|
195
183
|
pass
|
|
196
184
|
|
|
197
185
|
|
|
198
186
|
class AfterSocialRegister(_BaseSocialRegister):
|
|
199
|
-
|
|
200
187
|
"""
|
|
201
188
|
Add custom logic after user registers through social network.
|
|
202
189
|
|
|
@@ -219,7 +206,6 @@ class AfterSocialRegister(_BaseSocialRegister):
|
|
|
219
206
|
|
|
220
207
|
|
|
221
208
|
class AfterSocialLogIn(_BaseSocialRegister):
|
|
222
|
-
|
|
223
209
|
"""
|
|
224
210
|
Custom logic after user logs in through social network.
|
|
225
211
|
|
|
@@ -232,11 +218,9 @@ class AfterSocialLogIn(_BaseSocialRegister):
|
|
|
232
218
|
|
|
233
219
|
|
|
234
220
|
class SocialAccountAlreadyConnected(_BaseSocialRegister):
|
|
235
|
-
|
|
236
221
|
"""
|
|
237
222
|
Event raised when social account is already connected to some other user.
|
|
238
223
|
|
|
239
|
-
|
|
240
224
|
Allow to add custom logic, when someone tries to connect social account to
|
|
241
225
|
second user in application.
|
|
242
226
|
|
|
@@ -261,21 +245,18 @@ class SocialAccountAlreadyConnected(_BaseSocialRegister):
|
|
|
261
245
|
|
|
262
246
|
|
|
263
247
|
class BeforeEmailChange(_BaseRegisterEvent):
|
|
264
|
-
|
|
265
248
|
"""Allow to add custom validation (like checking password) before email change process."""
|
|
266
249
|
|
|
267
250
|
pass
|
|
268
251
|
|
|
269
252
|
|
|
270
253
|
class AfterEmailChange(_BaseRegisterEvent):
|
|
271
|
-
|
|
272
254
|
"""Allow to add some custom post-processing, like e-mail sending, after email change process."""
|
|
273
255
|
|
|
274
256
|
pass
|
|
275
257
|
|
|
276
258
|
|
|
277
259
|
class AfterEmailChangeActivation(_BaseRegisterEvent):
|
|
278
|
-
|
|
279
260
|
"""Allow to add custom logic, after changed email had been activated."""
|
|
280
261
|
|
|
281
262
|
pass
|
pyramid_fullauth/events.pyc
CHANGED
|
Binary file
|
pyramid_fullauth/exceptions.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013 -
|
|
1
|
+
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
2
2
|
#
|
|
3
3
|
# This module is part of pyramid_fullauth and is released under
|
|
4
4
|
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
@@ -6,42 +6,36 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class DeleteException(Exception):
|
|
9
|
-
|
|
10
9
|
"""Exception risen when the user can't be deleted."""
|
|
11
10
|
|
|
12
11
|
pass
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
class ValidateError(ValueError):
|
|
16
|
-
|
|
17
15
|
"""Base of every validate error in pyramid_fullauth."""
|
|
18
16
|
|
|
19
17
|
pass
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
class EmptyError(ValidateError):
|
|
23
|
-
|
|
24
21
|
"""Thrown whenever user is trying to set empty value."""
|
|
25
22
|
|
|
26
23
|
pass
|
|
27
24
|
|
|
28
25
|
|
|
29
26
|
class ShortPasswordError(ValidateError):
|
|
30
|
-
|
|
31
27
|
"""Thrown when password doesn't meet the length requirement."""
|
|
32
28
|
|
|
33
29
|
pass
|
|
34
30
|
|
|
35
31
|
|
|
36
32
|
class PasswordConfirmMismatchError(ValidateError):
|
|
37
|
-
|
|
38
33
|
"""Thrown when there's a mismatch with cpassword_confirm."""
|
|
39
34
|
|
|
40
35
|
pass
|
|
41
36
|
|
|
42
37
|
|
|
43
38
|
class EmailValidationError(ValidateError):
|
|
44
|
-
|
|
45
39
|
"""Exception thrown, when there's incorrect email provided."""
|
|
46
40
|
|
|
47
41
|
pass
|
pyramid_fullauth/exceptions.pyc
CHANGED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2013 -
|
|
1
|
+
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
2
2
|
#
|
|
3
3
|
# This module is part of pyramid_fullauth and is released under
|
|
4
4
|
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import sys
|
|
8
8
|
import uuid
|
|
9
|
+
from datetime import datetime
|
|
9
10
|
|
|
10
11
|
from sqlalchemy import (
|
|
11
12
|
Column, Unicode, String, Integer, Boolean, Sequence, DateTime,
|
|
@@ -15,15 +16,14 @@ from sqlalchemy.sql import func
|
|
|
15
16
|
from sqlalchemy.orm import validates, relationship
|
|
16
17
|
from sqlalchemy.orm.session import object_session
|
|
17
18
|
from sqlalchemy.orm.util import has_identity
|
|
18
|
-
|
|
19
|
+
from pyramid.compat import text_type
|
|
19
20
|
from pyramid_basemodel import Base
|
|
21
|
+
|
|
20
22
|
from pyramid_fullauth import exceptions
|
|
21
23
|
from pyramid_fullauth.models.mixins import UserPasswordMixin, UserEmailMixin
|
|
22
|
-
from datetime import datetime
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
class User(UserPasswordMixin, UserEmailMixin, Base):
|
|
26
|
-
|
|
27
27
|
"""User object."""
|
|
28
28
|
|
|
29
29
|
__tablename__ = 'users'
|
|
@@ -93,7 +93,7 @@ class User(UserPasswordMixin, UserEmailMixin, Base):
|
|
|
93
93
|
|
|
94
94
|
def __repr__(self):
|
|
95
95
|
"""Object representation."""
|
|
96
|
-
return "<User ('{0}'
|
|
96
|
+
return "<User ('{0}')>".format(self.id)
|
|
97
97
|
|
|
98
98
|
def __unicode__(self):
|
|
99
99
|
"""Unicode cast rules."""
|
|
@@ -102,7 +102,7 @@ class User(UserPasswordMixin, UserEmailMixin, Base):
|
|
|
102
102
|
elif self.email:
|
|
103
103
|
return self.email.split('@')[0] + '@...'
|
|
104
104
|
else:
|
|
105
|
-
return
|
|
105
|
+
return text_type(self.id)
|
|
106
106
|
|
|
107
107
|
def __str__(self): # pragma: no cover
|
|
108
108
|
"""String cast rules."""
|
|
@@ -152,7 +152,6 @@ class User(UserPasswordMixin, UserEmailMixin, Base):
|
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
class Group(Base):
|
|
155
|
-
|
|
156
155
|
"""User group object."""
|
|
157
156
|
|
|
158
157
|
__tablename__ = 'groups'
|
|
@@ -165,7 +164,6 @@ class Group(Base):
|
|
|
165
164
|
|
|
166
165
|
|
|
167
166
|
class AuthenticationProvider(Base):
|
|
168
|
-
|
|
169
167
|
"""Model to store authentication methods for different providers."""
|
|
170
168
|
|
|
171
169
|
__tablename__ = 'user_authentication_provider'
|
|
@@ -180,6 +178,7 @@ class AuthenticationProvider(Base):
|
|
|
180
178
|
|
|
181
179
|
user = relationship(User, backref='providers')
|
|
182
180
|
|
|
181
|
+
|
|
183
182
|
#: Association table between User and Group models.
|
|
184
183
|
user_group = Table(
|
|
185
184
|
'users_groups',
|
|
Binary file
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Copyright (c) by SQLAlchemy authors and contributors.
|
|
2
|
+
#
|
|
3
|
+
# This module's code is part of SQLAlchemy's documentation
|
|
4
|
+
# http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/hybrid.html#hybrid-value-objects
|
|
5
|
+
# and released under
|
|
6
|
+
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
7
|
+
"""CaseInsensitive comparator for sqlalchemy models."""
|
|
8
|
+
|
|
9
|
+
from sqlalchemy import func
|
|
10
|
+
from sqlalchemy.ext.hybrid import Comparator
|
|
11
|
+
from pyramid.compat import string_types
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CaseInsensitive(Comparator):
|
|
15
|
+
"""Hybrid value representing a lower case representation."""
|
|
16
|
+
|
|
17
|
+
def __init__(self, word):
|
|
18
|
+
"""Initialise comparator object."""
|
|
19
|
+
if isinstance(word, string_types):
|
|
20
|
+
self.word = word.lower()
|
|
21
|
+
elif isinstance(word, CaseInsensitive):
|
|
22
|
+
self.word = word.word
|
|
23
|
+
else:
|
|
24
|
+
self.word = func.lower(word)
|
|
25
|
+
|
|
26
|
+
def operate(self, op, other):
|
|
27
|
+
"""Operate."""
|
|
28
|
+
if not isinstance(other, CaseInsensitive):
|
|
29
|
+
other = CaseInsensitive(other)
|
|
30
|
+
return op(self.word, other.word)
|
|
31
|
+
|
|
32
|
+
def __clause_element__(self):
|
|
33
|
+
"""Get clause element for comparator.."""
|
|
34
|
+
return self.word
|
|
35
|
+
|
|
36
|
+
def __str__(self):
|
|
37
|
+
"""Cast element to."""
|
|
38
|
+
return self.word
|
|
Binary file
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
# Copyright (c) 2013 -
|
|
1
|
+
# Copyright (c) 2013 - 2016 by pyramid_fullauth authors and contributors <see AUTHORS file>
|
|
2
2
|
#
|
|
3
3
|
# This module is part of pyramid_fullauth and is released under
|
|
4
4
|
# the MIT License (MIT): http://opensource.org/licenses/MIT
|
|
5
|
+
"""Mixin's main module."""
|
|
5
6
|
|
|
6
7
|
from pyramid_fullauth.models.mixins.password import UserPasswordMixin
|
|
7
8
|
from pyramid_fullauth.models.mixins.email import UserEmailMixin
|
|
8
9
|
|
|
9
|
-
__all__ = (UserPasswordMixin, UserEmailMixin)
|
|
10
|
+
__all__ = ('UserPasswordMixin', 'UserEmailMixin')
|
|
Binary file
|