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
432b05a2
Commit
432b05a2
authored
9 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Solve invited reg bug using hidden field in reg form
parent
12ee9bb4
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
scipost/forms.py
+1
-2
1 addition, 2 deletions
scipost/forms.py
scipost/templates/scipost/register.html
+1
-1
1 addition, 1 deletion
scipost/templates/scipost/register.html
scipost/views.py
+5
-0
5 additions, 0 deletions
scipost/views.py
with
7 additions
and
3 deletions
scipost/forms.py
+
1
−
2
View file @
432b05a2
...
...
@@ -35,8 +35,7 @@ class RegistrationForm(forms.Form):
password
=
forms
.
CharField
(
label
=
'
* Password
'
,
widget
=
forms
.
PasswordInput
())
password_verif
=
forms
.
CharField
(
label
=
'
* Verify pwd
'
,
widget
=
forms
.
PasswordInput
())
captcha
=
CaptchaField
(
label
=
'
* I am not a robot
'
)
invited
=
forms
.
BooleanField
(
widget
=
forms
.
HiddenInput
())
class
RegistrationInvitationForm
(
forms
.
ModelForm
):
class
Meta
:
...
...
This diff is collapsed.
Click to expand it.
scipost/templates/scipost/register.html
+
1
−
1
View file @
432b05a2
...
...
@@ -7,7 +7,7 @@
<section>
<h1>
Register to SciPost
</h1>
{% if
welcome_message
%}
<!-- Temporary: only see form if invited (thus welcome_message exists) -->
{% if
form.invited
%}
<!-- Temporary: only see form if invited (thus welcome_message exists) -->
<div
class=
"flex-greybox"
>
<h2>
{{ welcome_message }}
</h2>
...
...
This diff is collapsed.
Click to expand it.
scipost/views.py
+
5
−
0
View file @
432b05a2
...
...
@@ -114,6 +114,9 @@ def register(request):
form
=
RegistrationForm
(
request
.
POST
)
Utils
.
load
({
'
form
'
:
form
})
if
form
.
is_valid
():
if
form
[
'
invited
'
]
==
False
:
return
render
(
request
,
'
scipost/register.html
'
,
{
'
form
'
:
form
,
'
errormessage
'
:
'
Registration is by invitation only at this stage. Come back after 1 May!
'
})
if
Utils
.
password_mismatch
():
return
render
(
request
,
'
scipost/register.html
'
,
{
'
form
'
:
form
,
'
errormessage
'
:
'
Your passwords must match
'
})
...
...
@@ -128,6 +131,7 @@ def register(request):
return
HttpResponseRedirect
(
'
thanks_for_registering
'
)
else
:
form
=
RegistrationForm
()
form
[
'
invited
'
]
=
False
context
=
{
'
form
'
:
form
}
return
render
(
request
,
'
scipost/register.html
'
,
context
)
...
...
@@ -271,6 +275,7 @@ def accept_invitation(request, key):
form
.
fields
[
'
last_name
'
].
initial
=
invitation
.
last_name
form
.
fields
[
'
first_name
'
].
initial
=
invitation
.
first_name
form
.
fields
[
'
email
'
].
initial
=
invitation
.
email_address
form
.
fields
[
'
invited
'
].
initial
=
True
errormessage
=
''
welcome_message
=
'
Welcome,
'
+
title_dict
[
invitation
.
title
]
+
'
'
+
invitation
.
last_name
+
'
, and thanks in advance for registering (by completing this form)
'
return
render
(
request
,
'
scipost/register.html
'
,
{
'
form
'
:
form
,
'
errormessage
'
:
errormessage
,
'
welcome_message
'
:
welcome_message
})
...
...
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