SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
SciPost
SciPost
Commits
aa7b460c
Commit
aa7b460c
authored
7 years ago
by
Jorran de Wit
Browse files
Options
Downloads
Patches
Plain Diff
Fix keys generator
parent
cbefe562
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
invitations/migrations/0011_auto_20180220_1139.py
+14
-1
14 additions, 1 deletion
invitations/migrations/0011_auto_20180220_1139.py
with
14 additions
and
1 deletion
invitations/migrations/0011_auto_20180220_1139.py
+
14
−
1
View file @
aa7b460c
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-02-20 10:39
from
__future__
import
unicode_literals
import
datetime
import
hashlib
import
random
import
string
from
django.utils
import
timezone
from
django.db
import
migrations
# Hack
...
...
@@ -92,7 +97,15 @@ def transfer_old_invitations_to_new_tables(apps, schema_editor):
)
if
new_inv
.
invitation_type
in
[
'
ci
'
,
'
cp
'
]:
new_inv
.
invitation_type
=
'
C
'
new_inv
.
refresh_keys
(
force_new_key
=
True
)
# Generate keys, custom methods are not loaded here
salt
=
''
for
i
in
range
(
5
):
salt
+=
random
.
choice
(
string
.
ascii_letters
)
salt
=
salt
.
encode
(
'
utf8
'
)
invitationsalt
=
new_inv
.
last_name
.
encode
(
'
utf8
'
)
new_inv
.
invitation_key
=
hashlib
.
sha1
(
salt
+
invitationsalt
).
hexdigest
()
new_inv
.
key_expires
=
timezone
.
now
()
+
datetime
.
timedelta
(
days
=
365
)
new_inv
.
save
()
if
invitation
.
cited_in_submission
:
...
...
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