Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Commits
1004f75a
Commit
1004f75a
authored
4 years ago
by
Flavio TARSETTI
Browse files
Options
Downloads
Patches
Plain Diff
[accounts][models/management-commands] Fixed typos
parent
edcb7941
No related branches found
No related tags found
1 merge request
!328
Improve automatic emails with temporary urls
Pipeline
#39860
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beat/web/accounts/management/commands/clean_expired_temporary_urls.py
+1
-1
1 addition, 1 deletion
...ounts/management/commands/clean_expired_temporary_urls.py
beat/web/accounts/models.py
+7
-2
7 additions, 2 deletions
beat/web/accounts/models.py
with
8 additions
and
3 deletions
beat/web/accounts/management/commands/clean_expired_temporary_urls.py
+
1
−
1
View file @
1004f75a
...
...
@@ -59,7 +59,7 @@ class Command(BaseCommand):
temporary_urls_count
=
TemporaryUrl
.
objects
.
all
().
count
()
now
=
datetime
.
datetime
.
now
()
count
=
TemporaryUrl
.
objects
.
filter
(
expires__lt
=
now
).
delete
()
[
0
]
count
,
_
=
TemporaryUrl
.
objects
.
filter
(
expires__lt
=
now
).
delete
()
self
.
stdout
.
write
(
'
{} Expired temporary url(s) successfully cleaned/
'
.
format
(
count
)
+
'
{} Total temporary url(s) checked
'
.
format
(
temporary_urls_count
))
...
...
This diff is collapsed.
Click to expand it.
beat/web/accounts/models.py
+
7
−
2
View file @
1004f75a
...
...
@@ -35,6 +35,12 @@ import random
import
string
import
datetime
# ------------------------------------------------------------------------------
# Constants
TEMPORARY_URL_LENGTH
=
32
# ------------------------------------------------------------------------------
class
AccountSettingsManager
(
models
.
Manager
):
def
get_by_natural_key
(
self
,
owner
):
...
...
@@ -158,10 +164,9 @@ class TemporaryUrlManager(models.Manager):
# Actions that result creating the object
# url_hash creation
length
=
32
url_hash
=
""
.
join
(
random
.
choice
(
string
.
ascii_letters
+
string
.
digits
)
# nosec
for
_
in
range
(
length
)
for
_
in
range
(
TEMPORARY_URL_LENGTH
)
)
now
=
datetime
.
datetime
.
now
()
expiration_date_delta
=
datetime
.
timedelta
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment