Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
forgotpwd
Commits
ba09a09dd8dd
Commit
b10d7f38
authored
May 15, 2013
by
Sylvain Thénault
Browse files
backport stable
parents
0ca275333b50
cd08fe5cb7fb
Changes
6
Hide whitespace changes
Inline
Side-by-side
.hgtags
View file @
ba09a09d
...
...
@@ -11,3 +11,5 @@ d2e13405b9d7144ee7ac920da7f4c30d99086bac cubicweb-forgotpwd-debian-version-0.3.0
9125bf2e856482c9095891409c8ee0292fe3b83c cubicweb-forgotpwd-debian-version-0.3.1-1
3aca7037d5aa1678e8fd6ec8fb859884f4f8e89f cubicweb-forgotpwd-version-0.4.0
2436ae8273776e9897ba8abd8f475d814bc0636d cubicweb-forgotpwd-debian-version-0.4.0-1
387dda6e118e4d7e42f3f3a89eeabf3d0135b876 cubicweb-forgotpwd-version-0.4.1
d35e6fc61e169e165ac8c29e11d4273db50925ef cubicweb-forgotpwd-debian-version-0.4.1-1
__pkginfo__.py
View file @
ba09a09d
...
...
@@ -4,7 +4,7 @@
modname
=
'forgotpwd'
distname
=
'cubicweb-forgotpwd'
numversion
=
(
0
,
4
,
0
)
numversion
=
(
0
,
4
,
1
)
version
=
'.'
.
join
(
str
(
num
)
for
num
in
numversion
)
license
=
'LGPL'
...
...
@@ -13,7 +13,14 @@ author_email = 'contact@logilab.fr'
description
=
'password recovery component for the CubicWeb framework'
web
=
'http://www.cubicweb.org/project/%s'
%
distname
__depends__
=
{
'cubicweb'
:
'>= 3.9.0'
,
classifiers
=
[
'Environment :: Web Environment'
,
'Framework :: CubicWeb'
,
'Programming Language :: Python'
,
'Programming Language :: JavaScript'
,
]
__depends__
=
{
'cubicweb'
:
'>= 3.15.0'
,
'pycrypto'
:
None
,
'PIL'
:
None
,
}
...
...
debian/changelog
View file @
ba09a09d
cubicweb-forgotpwd (0.4.1-1) unstable; urgency=low
* new upstream release
-- David Douard <david.douard@logilab.fr> Wed, 03 Apr 2013 16:07:21 +0200
cubicweb-forgotpwd (0.4.0-1) unstable; urgency=low
* new upstream release
...
...
hooks.py
View file @
ba09a09d
...
...
@@ -67,7 +67,7 @@ See you soon on %(base_url)s !
link
=
self
.
_cw
.
get_shared_data
(
'resetlink'
,
pop
=
True
)
user
=
fpasswd
.
reverse_has_fpasswd
[
0
]
return
{
'resetlink'
:
self
.
_cw
.
get_shared_data
(
'resetlink'
,
pop
=
True
)
,
'resetlink'
:
link
,
'login'
:
user
.
login
,
# NOTE: it would probably be better to display the expiration date
# (with correct timezone)
...
...
@@ -95,7 +95,9 @@ def forgotpwd_send_email(self, data):
raise
ValidationError
(
None
,
{
None
:
session
.
_
(
u
'An error occured, this email address is unknown.'
)})
data
[
'revocation_id'
]
=
revocation_id
key
=
encrypt
(
data
,
session
.
vreg
.
config
[
'forgotpwd-cypher-seed'
])
url
=
session
.
build_url
(
'forgottenpasswordrequest'
,
key
=
key
)
url
=
session
.
build_url
(
'forgottenpasswordrequest'
,
__secure__
=
True
,
key
=
key
,)
session
.
set_shared_data
(
'resetlink'
,
url
)
# mail is sent on commit
session
.
commit
()
...
...
setup.py
View file @
ba09a09d
...
...
@@ -41,7 +41,7 @@ from distutils.command import install_data
# import required features
from
__pkginfo__
import
modname
,
version
,
license
,
description
,
web
,
\
author
,
author_email
author
,
author_email
,
classifiers
if
exists
(
'README'
):
long_description
=
file
(
'README'
).
read
()
...
...
@@ -193,6 +193,7 @@ def install(**kwargs):
data_files
=
data_files
,
ext_modules
=
ext_modules
,
cmdclass
=
cmdclass
,
classifiers
=
classifiers
,
**
kwargs
)
...
...
test/unittest_notifications.py
0 → 100644
View file @
ba09a09d
from
datetime
import
date
from
logilab.common.testlib
import
unittest_main
from
cubicweb.devtools.testlib
import
MAILBOX
,
CubicWebTC
from
cubicweb.devtools.fake
import
FakeConfig
from
cubicweb.web.request
import
CubicWebRequestBase
class
ForgotTC
(
CubicWebTC
):
def
setup_database
(
self
):
req
=
self
.
request
()
for
index
in
xrange
(
4
):
user
=
self
.
create_user
(
req
,
u
'test_user%s'
%
index
)
req
.
create_entity
(
'EmailAddress'
,
address
=
u
'test_user%s@logilab.fr'
%
index
,
reverse_use_email
=
user
)
def
test_reset_password
(
self
):
MAILBOX
[:]
=
[]
self
.
assertEqual
(
len
(
MAILBOX
),
0
)
self
.
session
.
repo
.
forgotpwd_send_email
({
'use_email'
:
'test_user1@logilab.fr'
})
self
.
assertEqual
(
len
(
MAILBOX
),
1
)
self
.
assert_
(
'None'
not
in
MAILBOX
[
0
].
content
)
def
test_reset_https
(
self
):
MAILBOX
[:]
=
[]
self
.
config
.
global_set_option
(
'base-url'
,
'http://babar.com/'
)
self
.
session
.
repo
.
forgotpwd_send_email
({
'use_email'
:
'test_user2@logilab.fr'
})
self
.
assert_
(
'http://babar.com/'
in
MAILBOX
[
0
].
content
)
self
.
config
.
global_set_option
(
'https-url'
,
'https://babar.com/'
)
self
.
session
.
repo
.
forgotpwd_send_email
({
'use_email'
:
'test_user3@logilab.fr'
})
print
MAILBOX
[
1
].
content
self
.
assert_
(
'https://babar.com/'
in
MAILBOX
[
1
].
content
)
if
__name__
==
'__main__'
:
unittest_main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment