Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
site-kwei
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
aeltheos
site-kwei
Commits
d4a783b6
Commit
d4a783b6
authored
4 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Added settings to close registrations
parent
2a591bfd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
accounts/views.py
+6
-2
6 additions, 2 deletions
accounts/views.py
interludes/settings.py
+5
-0
5 additions, 0 deletions
interludes/settings.py
with
11 additions
and
2 deletions
accounts/views.py
+
6
−
2
View file @
d4a783b6
from
django.
shortcuts
import
render
,
redirect
from
django.
conf
import
settings
from
django.contrib.auth
import
authenticate
,
login
,
logout
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
Http404
from
django.shortcuts
import
render
,
redirect
from
accounts.forms
import
CreateAccountForm
...
...
@@ -12,6 +14,8 @@ def logout_view(request):
def
create_account
(
request
):
"""
Vue pour l
'
inscription
"""
if
not
settings
.
REGISTRATION_USER_CREATION_OPEN
:
raise
Http404
(
"
La création de compte n
'
est pas ouverte actuellement
"
)
if
request
.
method
==
'
POST
'
:
form
=
CreateAccountForm
(
request
.
POST
)
if
form
.
is_valid
():
...
...
@@ -29,4 +33,4 @@ def create_account(request):
return
redirect
(
'
home
'
)
else
:
form
=
CreateAccountForm
()
return
render
(
request
,
'
create_account.html
'
,
{
'
form
'
:
form
})
return
render
(
request
,
'
registration/
create_account.html
'
,
{
'
form
'
:
form
})
This diff is collapsed.
Click to expand it.
interludes/settings.py
+
5
−
0
View file @
d4a783b6
...
...
@@ -129,3 +129,8 @@ STATIC_URL = '/static/'
STATIC_ROOT
=
os
.
path
.
join
(
BASE_DIR
,
'
static
'
)
LOGIN_REDIRECT_URL
=
'
home
'
# Blocks account creation when false
REGISTRATION_USER_CREATION_OPEN
=
True
# Blocks event inscription
REGISTRATION_EVENT_INSCRIPTIONS_OPEN
=
True
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