pyramid-fullauth 0.3.2__py2.7.egg → 0.5.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.
Files changed (82) hide show
  1. EGG-INFO/PKG-INFO +41 -10
  2. EGG-INFO/SOURCES.txt +2 -0
  3. EGG-INFO/requires.txt +4 -6
  4. pyramid_fullauth/__init__.py +3 -3
  5. pyramid_fullauth/__init__.pyc +0 -0
  6. pyramid_fullauth/auth.py +2 -1
  7. pyramid_fullauth/auth.pyc +0 -0
  8. pyramid_fullauth/compat.py +18 -0
  9. pyramid_fullauth/compat.pyc +0 -0
  10. pyramid_fullauth/events.py +0 -1
  11. pyramid_fullauth/events.pyc +0 -0
  12. pyramid_fullauth/exceptions.pyc +0 -0
  13. pyramid_fullauth/models/__init__.py +5 -4
  14. pyramid_fullauth/models/__init__.pyc +0 -0
  15. pyramid_fullauth/models/extensions/__init__.py +39 -0
  16. pyramid_fullauth/models/extensions/__init__.pyc +0 -0
  17. pyramid_fullauth/models/mixins/__init__.pyc +0 -0
  18. pyramid_fullauth/models/mixins/email.py +53 -6
  19. pyramid_fullauth/models/mixins/email.pyc +0 -0
  20. pyramid_fullauth/models/mixins/password.pyc +0 -0
  21. pyramid_fullauth/request.py +5 -4
  22. pyramid_fullauth/request.pyc +0 -0
  23. pyramid_fullauth/resources/helpers/social.mako +3 -3
  24. pyramid_fullauth/resources/locale/pyramid_fullauth.pot +23 -23
  25. pyramid_fullauth/routing/__init__.pyc +0 -0
  26. pyramid_fullauth/routing/predicates.pyc +0 -0
  27. pyramid_fullauth/tools.py +6 -3
  28. pyramid_fullauth/tools.pyc +0 -0
  29. pyramid_fullauth/views/__init__.pyc +0 -0
  30. pyramid_fullauth/views/basic/__init__.pyc +0 -0
  31. pyramid_fullauth/views/basic/activate.pyc +0 -0
  32. pyramid_fullauth/views/basic/forbidden.py +2 -3
  33. pyramid_fullauth/views/basic/forbidden.pyc +0 -0
  34. pyramid_fullauth/views/basic/login.py +7 -7
  35. pyramid_fullauth/views/basic/login.pyc +0 -0
  36. pyramid_fullauth/views/basic/logout.pyc +0 -0
  37. pyramid_fullauth/views/basic/profile/__init__.pyc +0 -0
  38. pyramid_fullauth/views/basic/profile/email.py +2 -1
  39. pyramid_fullauth/views/basic/profile/email.pyc +0 -0
  40. pyramid_fullauth/views/basic/profile/password.py +5 -4
  41. pyramid_fullauth/views/basic/profile/password.pyc +0 -0
  42. pyramid_fullauth/views/basic/register.py +7 -6
  43. pyramid_fullauth/views/basic/register.pyc +0 -0
  44. pyramid_fullauth/views/social.py +6 -3
  45. pyramid_fullauth/views/social.pyc +0 -0
  46. tests/__init__.pyc +0 -0
  47. tests/conftest.py +2 -1
  48. tests/conftest.pyc +0 -0
  49. tests/tools.pyc +0 -0
  50. tests/unit/test_default_settings.pyc +0 -0
  51. tests/unit/test_groupfinder.pyc +0 -0
  52. tests/unit/test_social_view.py +28 -26
  53. tests/unit/test_social_view.pyc +0 -0
  54. tests/unit/test_tools.pyc +0 -0
  55. tests/unit/test_user_active.pyc +0 -0
  56. tests/unit/test_user_admin.pyc +0 -0
  57. tests/unit/test_user_email.pyc +0 -0
  58. tests/unit/test_user_password.py +1 -1
  59. tests/unit/test_user_password.pyc +0 -0
  60. tests/unit/test_user_providers.pyc +0 -0
  61. tests/unit/test_user_repr.py +2 -2
  62. tests/unit/test_user_repr.pyc +0 -0
  63. tests/unit/test_validators.py +1 -1
  64. tests/unit/test_validators.pyc +0 -0
  65. tests/views/__init__.pyc +0 -0
  66. tests/views/conftest.py +5 -0
  67. tests/views/conftest.pyc +0 -0
  68. tests/views/test_activation.py +13 -6
  69. tests/views/test_activation.pyc +0 -0
  70. tests/views/test_email.py +2 -2
  71. tests/views/test_email.pyc +0 -0
  72. tests/views/test_events.py +36 -33
  73. tests/views/test_events.pyc +0 -0
  74. tests/views/test_login.py +23 -2
  75. tests/views/test_login.pyc +0 -0
  76. tests/views/test_login_social.py +97 -69
  77. tests/views/test_login_social.pyc +0 -0
  78. tests/views/test_logout.pyc +0 -0
  79. tests/views/test_register.py +9 -5
  80. tests/views/test_register.pyc +0 -0
  81. tests/views/test_reset.py +9 -4
  82. 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.2
3
+ Version: 0.5.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.4.1
18
+ :target: https://readthedocs.org/projects/pyramid_fullauth/?badge=v0.4.1
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
@@ -35,17 +39,17 @@ Description: pyramid_fullauth
35
39
  Package status
36
40
  --------------
37
41
 
38
- .. image:: https://travis-ci.org/fizyk/pyramid_fullauth.png?branch=master
42
+ .. image:: https://travis-ci.org/fizyk/pyramid_fullauth.png?branch=v0.4.1
39
43
  :target: https://travis-ci.org/fizyk/pyramid_fullauth
40
44
  :alt: Tests
41
45
 
42
- .. image:: https://coveralls.io/repos/fizyk/pyramid_fullauth/badge.png?branch=master
43
- :target: https://coveralls.io/r/fizyk/pyramid_fullauth?branch=master
46
+ .. image:: https://coveralls.io/repos/fizyk/pyramid_fullauth/badge.png?branch=v0.4.1
47
+ :target: https://coveralls.io/r/fizyk/pyramid_fullauth?branch=v0.4.1
44
48
  :alt: Coverage Status
45
49
 
46
- .. image:: https://requires.io/github/fizyk/pyramid_fullauth/requirements.png?branch=master
47
- :target: https://requires.io/github/fizyk/pyramid_fullauth/requirements/?branch=master
48
- :alt: Requirements Status
50
+ .. image:: https://requires.io/github/fizyk/pyramid_fullauth/requirements.svg?tag=v0.4.1
51
+ :target: https://requires.io/github/fizyk/pyramid_fullauth/requirements/?tag=v0.4.1
52
+ :alt: Requirements Status
49
53
 
50
54
  Package resources
51
55
  -----------------
@@ -54,8 +58,8 @@ Description: pyramid_fullauth
54
58
  * Documentation: http://pyramid-fullauth.readthedocs.org/
55
59
  * PyPI: https://pypi.python.org/pypi/pyramid_fullauth
56
60
 
57
- Instalation
58
- -----------
61
+ Installation
62
+ ------------
59
63
 
60
64
  ``pip install pyramid_fullauth``
61
65
 
@@ -73,6 +77,32 @@ Description: pyramid_fullauth
73
77
  CHANGELOG
74
78
  =========
75
79
 
80
+ 0.5.0
81
+ -------
82
+
83
+ - full python3 compatibility, since velruse migrated to py3 enabled requests-oauth
84
+ -require velruse 1.1.1
85
+ - run tests with sqlalchemy 1.0.x
86
+ - small updates to conform with new linters versions embedded in pylama
87
+
88
+ 0.4.1
89
+ -------
90
+
91
+ - fixed spelling for error message when user does not exist while trying to reset password.
92
+ - require pyramid_basemodel at least version 0.3
93
+
94
+ 0.4.0
95
+ -------
96
+
97
+ - python 3 compatibility (without oauth2 though)
98
+ - cleared use of deprecated function `pyramid.security.authenticated_userid` in favour of `pyramid.request.Request.authenticated_userid` attribute.
99
+ - make email fields case insensitive by using hybrid properties and CaseInsensitive comparator for model.
100
+
101
+ 0.3.3
102
+ -------
103
+
104
+ - Fix issue where groupfined was returning empty list instead of None when user did not existed
105
+
76
106
  0.3.2
77
107
  -----
78
108
 
@@ -166,6 +196,7 @@ Classifier: License :: OSI Approved :: MIT License
166
196
  Classifier: Natural Language :: English
167
197
  Classifier: Operating System :: OS Independent
168
198
  Classifier: Programming Language :: Python
169
- Classifier: Programming Language :: Python :: 2.6
170
199
  Classifier: Programming Language :: Python :: 2.7
200
+ Classifier: Programming Language :: Python :: 3.3
201
+ Classifier: Programming Language :: Python :: 3.4
171
202
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
EGG-INFO/SOURCES.txt CHANGED
@@ -25,6 +25,7 @@ docs/source/api/request.rst
25
25
  docs/source/api/tools.rst
26
26
  pyramid_fullauth/__init__.py
27
27
  pyramid_fullauth/auth.py
28
+ pyramid_fullauth/compat.py
28
29
  pyramid_fullauth/events.py
29
30
  pyramid_fullauth/exceptions.py
30
31
  pyramid_fullauth/request.py
@@ -37,6 +38,7 @@ pyramid_fullauth.egg-info/requires.txt
37
38
  pyramid_fullauth.egg-info/top_level.txt
38
39
  pyramid_fullauth/config/default.yaml
39
40
  pyramid_fullauth/models/__init__.py
41
+ pyramid_fullauth/models/extensions/__init__.py
40
42
  pyramid_fullauth/models/mixins/__init__.py
41
43
  pyramid_fullauth/models/mixins/email.py
42
44
  pyramid_fullauth/models/mixins/password.py
EGG-INFO/requires.txt CHANGED
@@ -2,8 +2,8 @@ pyramid_localize
2
2
  pyramid >=1.4
3
3
  pyramid_mako
4
4
  tzf.pyramid_yml >=1.0
5
- pyramid_basemodel
6
- velruse
5
+ pyramid_basemodel>=0.3
6
+ velruse >=1.1.1
7
7
 
8
8
  [docs]
9
9
  sphinx
@@ -11,7 +11,5 @@ sphinx
11
11
  [tests]
12
12
  mock
13
13
  pytest_pyramid
14
- pytest-dbfixtures
15
- mysql-python
16
- psycopg2
17
- pytest-cov
14
+ pytest-cov
15
+ pytest-dbfixtures[mysql,postgresql]
@@ -3,7 +3,6 @@
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.3.2'
19
+ __version__ = '0.5.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. If social is not available, we will not turn it on!
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
 
Binary file
pyramid_fullauth/auth.py CHANGED
@@ -38,7 +38,8 @@ def groupfinder(userid, request):
38
38
  else:
39
39
  groups.append('s:inactive')
40
40
 
41
- return groups
41
+ return groups
42
+ return None
42
43
 
43
44
 
44
45
  class BaseACLRootFactoryMixin(object):
pyramid_fullauth/auth.pyc CHANGED
Binary file
@@ -0,0 +1,18 @@
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
+ else:
15
+ from urllib.parse import urlencode, urlparse, parse_qs
16
+
17
+
18
+ __all__ = ('urlencode', 'urlparse', 'parse_qs')
Binary file
@@ -236,7 +236,6 @@ class SocialAccountAlreadyConnected(_BaseSocialRegister):
236
236
  """
237
237
  Event raised when social account is already connected to some other user.
238
238
 
239
-
240
239
  Allow to add custom logic, when someone tries to connect social account to
241
240
  second user in application.
242
241
 
Binary file
Binary file
@@ -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,11 +16,11 @@ 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):
@@ -93,7 +94,7 @@ class User(UserPasswordMixin, UserEmailMixin, Base):
93
94
 
94
95
  def __repr__(self):
95
96
  """Object representation."""
96
- return "<User ('{0}', '{1}')>".format(self.id, str(self))
97
+ return "<User ('{0}')>".format(self.id)
97
98
 
98
99
  def __unicode__(self):
99
100
  """Unicode cast rules."""
@@ -102,7 +103,7 @@ class User(UserPasswordMixin, UserEmailMixin, Base):
102
103
  elif self.email:
103
104
  return self.email.split('@')[0] + '@...'
104
105
  else:
105
- return str(self.id)
106
+ return text_type(self.id)
106
107
 
107
108
  def __str__(self): # pragma: no cover
108
109
  """String cast rules."""
Binary file
@@ -0,0 +1,39 @@
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
+
16
+ """Hybrid value representing a lower case representation."""
17
+
18
+ def __init__(self, word):
19
+ """Initialise comparator object."""
20
+ if isinstance(word, string_types):
21
+ self.word = word.lower()
22
+ elif isinstance(word, CaseInsensitive):
23
+ self.word = word.word
24
+ else:
25
+ self.word = func.lower(word)
26
+
27
+ def operate(self, op, other):
28
+ """Operate."""
29
+ if not isinstance(other, CaseInsensitive):
30
+ other = CaseInsensitive(other)
31
+ return op(self.word, other.word)
32
+
33
+ def __clause_element__(self):
34
+ """Get clause element for comparator.."""
35
+ return self.word
36
+
37
+ def __str__(self):
38
+ """Cast element to."""
39
+ return self.word
Binary file
@@ -7,13 +7,13 @@
7
7
  import re
8
8
  import uuid
9
9
 
10
- from sqlalchemy import Column
11
- from sqlalchemy import Unicode
12
- from sqlalchemy import String
10
+ from sqlalchemy import Column, Unicode, String
13
11
  from sqlalchemy.orm import validates
12
+ from sqlalchemy.ext.hybrid import hybrid_property
14
13
 
15
14
 
16
15
  from pyramid_fullauth.exceptions import EmptyError, EmailValidationError
16
+ from pyramid_fullauth.models.extensions import CaseInsensitive
17
17
 
18
18
  pattern_mail = re.compile(
19
19
  r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]{0,256}(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+){0,256}" # dot-atom
@@ -29,11 +29,58 @@ class UserEmailMixin(object):
29
29
 
30
30
  __pattern_mail = pattern_mail
31
31
 
32
- email = Column(Unicode(254), unique=True, nullable=False) # RFC5321 and RFC3696(errata)
33
- new_email = Column(Unicode(254), unique=True, nullable=True) # RFC5321 and RFC3696(errata)
32
+ _email = Column('email', Unicode(254), unique=True, nullable=False) # RFC5321 and RFC3696(errata)
33
+ _new_email = Column('new_email', Unicode(254), unique=True, nullable=True) # RFC5321 and RFC3696(errata)
34
34
  email_change_key = Column(String(255), default=None, unique=True)
35
35
 
36
- @validates('email', 'new_email')
36
+ def __init__(self, *args, **kwargs):
37
+ """Switch possible email and new_email kwarg into new column attribute names."""
38
+ if 'email' in kwargs:
39
+ kwargs['_email'] = kwargs.pop('email')
40
+ if 'new_email' in kwargs:
41
+ kwargs['_new_email'] - kwargs.pop('new_email')
42
+
43
+ super(UserEmailMixin, self).__init__(*args, **kwargs)
44
+
45
+ @hybrid_property
46
+ def email(self):
47
+ """Email field getter."""
48
+ if self._email:
49
+ return self._email.lower()
50
+ return self._email
51
+
52
+ @email.setter
53
+ def email(self, value):
54
+ """Email field setter."""
55
+ if value:
56
+ value = value.lower()
57
+ self._email = value
58
+
59
+ @email.comparator
60
+ def email(cls):
61
+ """Email field comparator."""
62
+ return CaseInsensitive(cls._email)
63
+
64
+ @hybrid_property
65
+ def new_email(self):
66
+ """New email field getter."""
67
+ if self._new_email:
68
+ return self._new_email.lower()
69
+ return self._new_email
70
+
71
+ @new_email.setter
72
+ def new_email(self, value):
73
+ """New email field setter."""
74
+ if value:
75
+ value = value.lower()
76
+ self._new_email = value
77
+
78
+ @new_email.comparator
79
+ def new_email(cls):
80
+ """New email field comparator."""
81
+ return CaseInsensitive(cls._new_email)
82
+
83
+ @validates('_email', '_new_email')
37
84
  def validate_email(self, key, address):
38
85
  """
39
86
  Validate email addresses.
Binary file
Binary file
@@ -5,7 +5,7 @@
5
5
  """These method gets added to each ``pyramid.request.Request`` object."""
6
6
 
7
7
  from pyramid.httpexceptions import HTTPSeeOther
8
- from pyramid.security import remember, unauthenticated_userid, forget
8
+ from pyramid.security import remember, forget
9
9
  from sqlalchemy.sql.expression import func
10
10
  from sqlalchemy.orm.exc import NoResultFound
11
11
  import pyramid_basemodel
@@ -49,10 +49,11 @@ def user(request):
49
49
  :returns: logged in user object, or None
50
50
  :rtype: pyramid_fullauth.models.User
51
51
  """
52
- userid = unauthenticated_userid(request)
53
- if userid:
52
+ if request.unauthenticated_userid:
54
53
  try:
55
- user = pyramid_basemodel.Session.query(User).filter(User.id == userid).one()
54
+ user = pyramid_basemodel.Session.query(User).filter(
55
+ User.id == request.unauthenticated_userid
56
+ ).one()
56
57
  return user
57
58
  except NoResultFound: # pragma: no cover
58
59
  pass
Binary file
@@ -1,6 +1,6 @@
1
1
  ## -*- coding: utf-8 -*-
2
2
  <%doc>
3
- Copyright (c) 2013 - 2014 by pyramid_fullauth authors and contributors <see AUTHORS file>
3
+ Copyright (c) 2013 - 2015 by pyramid_fullauth authors and contributors <see AUTHORS file>
4
4
 
5
5
  This module is part of pyramid_fullauth and is released under
6
6
  the MIT License (MIT): http://opensource.org/licenses/MIT
@@ -9,9 +9,9 @@ the MIT License (MIT): http://opensource.org/licenses/MIT
9
9
  <%def name="social_auth_uri(name, **kw)">
10
10
  <%
11
11
  from velruse import login_url
12
- import urllib
12
+ from pyramid_fullauth.compat import urlencode
13
13
  %>
14
14
  % if name in request.registry['config'].fullauth.social:
15
- ${login_url(request, name) + ('?{0}'.format(urllib.urlencode(kw)) if kw else '')}
15
+ ${login_url(request, name) + ('?{0}'.format(urlencode(kw)) if kw else '')}
16
16
  % endif
17
17
  </%def>
@@ -1,15 +1,15 @@
1
1
  # Translations template for pyramid_fullauth.
2
- # Copyright (C) 2014 ORGANIZATION
2
+ # Copyright (C) 2015 ORGANIZATION
3
3
  # This file is distributed under the same license as the pyramid_fullauth
4
4
  # project.
5
- # FIRST AUTHOR <EMAIL@ADDRESS>, 2014.
5
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
6
6
  #
7
7
  #, fuzzy
8
8
  msgid ""
9
9
  msgstr ""
10
- "Project-Id-Version: pyramid_fullauth 0.2.3\n"
10
+ "Project-Id-Version: pyramid_fullauth 0.4.0\n"
11
11
  "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
12
- "POT-Creation-Date: 2014-04-11 23:41+0200\n"
12
+ "POT-Creation-Date: 2015-02-10 00:36+0100\n"
13
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,16 +18,16 @@ msgstr ""
18
18
  "Content-Transfer-Encoding: 8bit\n"
19
19
  "Generated-By: Babel 1.3\n"
20
20
 
21
- #: pyramid_fullauth/tools.py:47
21
+ #: pyramid_fullauth/tools.py:50
22
22
  msgid "Please enter your password"
23
23
  msgstr ""
24
24
 
25
- #: pyramid_fullauth/tools.py:53
25
+ #: pyramid_fullauth/tools.py:56
26
26
  msgid "Password is too short"
27
27
  msgstr ""
28
28
 
29
- #: pyramid_fullauth/tools.py:61
30
- #: pyramid_fullauth/views/basic/profile/password.py:124
29
+ #: pyramid_fullauth/tools.py:64
30
+ #: pyramid_fullauth/views/basic/profile/password.py:123
31
31
  msgid "password-mismatch"
32
32
  msgstr ""
33
33
 
@@ -100,7 +100,7 @@ msgid "Change your email"
100
100
  msgstr ""
101
101
 
102
102
  #: pyramid_fullauth/resources/templates/email_change.mako:15
103
- #: pyramid_fullauth/resources/templates/login.mako:11
103
+ #: pyramid_fullauth/resources/templates/login.mako:12
104
104
  #: pyramid_fullauth/resources/templates/register.mako:13
105
105
  #: pyramid_fullauth/resources/templates/reset.mako:15
106
106
  #: pyramid_fullauth/resources/templates/reset.proceed.mako:14
@@ -120,7 +120,7 @@ msgstr ""
120
120
  msgid "Welcome, to pyramid_fullauth!"
121
121
  msgstr ""
122
122
 
123
- #: pyramid_fullauth/resources/templates/login.mako:9
123
+ #: pyramid_fullauth/resources/templates/login.mako:10
124
124
  msgid "Please, log in"
125
125
  msgstr ""
126
126
 
@@ -149,23 +149,23 @@ msgstr ""
149
149
  msgid "Recover your password - choose new password"
150
150
  msgstr ""
151
151
 
152
- #: pyramid_fullauth/views/social.py:134
152
+ #: pyramid_fullauth/views/social.py:139
153
153
  msgid "Your account is already connected to other ${provider} account."
154
154
  msgstr ""
155
155
 
156
- #: pyramid_fullauth/views/social.py:141
156
+ #: pyramid_fullauth/views/social.py:146
157
157
  msgid "Your account has been connected to ${provider} account."
158
158
  msgstr ""
159
159
 
160
- #: pyramid_fullauth/views/social.py:147
160
+ #: pyramid_fullauth/views/social.py:152
161
161
  msgid "This ${provider} account is already connected with other account."
162
162
  msgstr ""
163
163
 
164
- #: pyramid_fullauth/views/basic/forbidden.py:39
164
+ #: pyramid_fullauth/views/basic/forbidden.py:38
165
165
  msgid "forbidden-notallowed"
166
166
  msgstr ""
167
167
 
168
- #: pyramid_fullauth/views/basic/forbidden.py:44
168
+ #: pyramid_fullauth/views/basic/forbidden.py:43
169
169
  msgid "forbidden-login"
170
170
  msgstr ""
171
171
 
@@ -178,35 +178,35 @@ msgid "Already logged in!"
178
178
  msgstr ""
179
179
 
180
180
  #: pyramid_fullauth/views/basic/login.py:95
181
- #: pyramid_fullauth/views/basic/login.py:133
181
+ #: pyramid_fullauth/views/basic/login.py:126
182
182
  msgid "Wrong e-mail or password."
183
183
  msgstr ""
184
184
 
185
- #: pyramid_fullauth/views/basic/register.py:38
185
+ #: pyramid_fullauth/views/basic/register.py:39
186
186
  msgid "You have an error in your registration form"
187
187
  msgstr ""
188
188
 
189
- #: pyramid_fullauth/views/basic/register.py:51
189
+ #: pyramid_fullauth/views/basic/register.py:52
190
190
  msgid "You have successfully registered"
191
191
  msgstr ""
192
192
 
193
- #: pyramid_fullauth/views/basic/register.py:75
193
+ #: pyramid_fullauth/views/basic/register.py:76
194
194
  msgid "User with given e-mail already exists!"
195
195
  msgstr ""
196
196
 
197
- #: pyramid_fullauth/views/basic/profile/email.py:44
197
+ #: pyramid_fullauth/views/basic/profile/email.py:45
198
198
  msgid "User with this email exists"
199
199
  msgstr ""
200
200
 
201
- #: pyramid_fullauth/views/basic/profile/email.py:60
201
+ #: pyramid_fullauth/views/basic/profile/email.py:61
202
202
  msgid "E-mail is empty"
203
203
  msgstr ""
204
204
 
205
- #: pyramid_fullauth/views/basic/profile/email.py:66
205
+ #: pyramid_fullauth/views/basic/profile/email.py:67
206
206
  msgid "Incorrect e-mail format"
207
207
  msgstr ""
208
208
 
209
- #: pyramid_fullauth/views/basic/profile/email.py:73
209
+ #: pyramid_fullauth/views/basic/profile/email.py:74
210
210
  msgid "We sent you email to activate your new email address"
211
211
  msgstr ""
212
212
 
Binary file
Binary file
pyramid_fullauth/tools.py CHANGED
@@ -6,12 +6,15 @@
6
6
 
7
7
  import string
8
8
  from random import choice
9
+
10
+ from pyramid.compat import text_type
11
+
9
12
  from pyramid_fullauth.exceptions import (
10
13
  EmptyError, ShortPasswordError, PasswordConfirmMismatchError
11
14
  )
12
15
 
13
16
 
14
- def password_generator(length, chars=(string.letters + string.digits + string.punctuation)):
17
+ def password_generator(length, chars=(string.ascii_letters + string.digits + string.punctuation)):
15
18
  """
16
19
  Generate random password.
17
20
 
@@ -24,7 +27,7 @@ def password_generator(length, chars=(string.letters + string.digits + string.pu
24
27
  :returns: password
25
28
  :rtype: str
26
29
  """
27
- return u''.join([choice(chars) for i in range(length)])
30
+ return text_type(''.join([choice(chars) for i in range(length)]))
28
31
 
29
32
 
30
33
  def validate_passsword(request, password, user=None):
@@ -55,7 +58,7 @@ def validate_passsword(request, password, user=None):
55
58
 
56
59
  # here if password doesn't match
57
60
  if password_config['confirm']:
58
- confirm_password = request.POST.get('confirm_password', u'')
61
+ confirm_password = request.POST.get('confirm_password', text_type(''))
59
62
  if password != confirm_password:
60
63
  raise PasswordConfirmMismatchError(
61
64
  request._('password-mismatch',
Binary file
Binary file
Binary file
Binary file
@@ -5,7 +5,6 @@
5
5
  """Forbidden views."""
6
6
 
7
7
  from pyramid.view import forbidden_view_config
8
- from pyramid.security import authenticated_userid
9
8
  from pyramid.httpexceptions import HTTPFound
10
9
 
11
10
  from pyramid_fullauth.views import BaseView
@@ -24,7 +23,7 @@ class ForbiddenViews(BaseView):
24
23
  def forbidden(self):
25
24
  """Forbidden page view."""
26
25
  # do not allow a user to login if they are already logged in
27
- if authenticated_userid(self.request):
26
+ if self.request.authenticated_userid:
28
27
  return {}
29
28
 
30
29
  loc = self.request.route_path('login', _query=(('after', self.request.path),))
@@ -34,7 +33,7 @@ class ForbiddenViews(BaseView):
34
33
  def forbidden_json(self):
35
34
  """Forbidden xhr response."""
36
35
  # do not allow a user to login if they are already logged in
37
- if authenticated_userid(self.request):
36
+ if self.request.authenticated_userid:
38
37
  return {'status': False, 'msg':
39
38
  self.request._('forbidden-notallowed',
40
39
  default='You are not allowed to use this function',
Binary file