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
318b6c1bb1fa
Commit
5a6040c3
authored
Apr 09, 2014
by
Julien Cristau
Browse files
[hooks] use internal_cnx instead of internal_session
New in cubicweb 3.19
parent
70a8b5152aad
Changes
3
Hide whitespace changes
Inline
Side-by-side
__pkginfo__.py
View file @
318b6c1b
...
...
@@ -20,7 +20,7 @@ classifiers = [
'Programming Language :: JavaScript'
,
]
__depends__
=
{
'cubicweb'
:
'>= 3.1
5
.0'
,
__depends__
=
{
'cubicweb'
:
'>= 3.1
9
.0'
,
'pycrypto'
:
None
,
'PIL'
:
None
,
}
...
...
debian/control
View file @
318b6c1b
...
...
@@ -8,7 +8,7 @@ Homepage: http://www.cubicweb.org/project/cubicweb-forgotpwd
Package: cubicweb-forgotpwd
Architecture: all
Depends: cubicweb-common (>= 3.9.0), python-crypto, python-imaging
Depends: cubicweb-common (>= 3.
1
9.0), python-crypto, python-imaging
Description: password recovery component for the CubicWeb framework
This CubicWeb component provides password recovery functionnality.
.
...
...
hooks.py
View file @
318b6c1b
...
...
@@ -25,13 +25,10 @@ class ServerStartupHook(hook.Hook):
# XXX use named args and inner functions to avoid referencing globals
# which may cause reloading pb
def
cleaning_revocation_key
(
repo
,
now
=
datetime
.
now
):
session
=
repo
.
internal_session
()
try
:
session
.
execute
(
'DELETE Fpasswd F WHERE F revocation_date < %(date)s'
,
{
'date'
:
now
()})
session
.
commit
()
finally
:
session
.
close
()
with
repo
.
internal_cnx
()
as
cnx
:
cnx
.
execute
(
'DELETE Fpasswd F WHERE F revocation_date < %(date)s'
,
{
'date'
:
now
()})
cnx
.
commit
()
# run looping task often enough to purge pwd-reset requests
limit
=
self
.
repo
.
vreg
.
config
[
'revocation-limit'
]
*
60
self
.
repo
.
looping_task
(
limit
,
cleaning_revocation_key
,
self
.
repo
)
...
...
Write
Preview
Supports
Markdown
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