Skip to content

Commit

Permalink
Adding user to a default group on creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Mann committed Nov 17, 2024
1 parent 6e1bc25 commit b068077
Show file tree
Hide file tree
Showing 17 changed files with 558 additions and 481 deletions.
8 changes: 6 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ repos:
rev: 6.1.0
hooks:
- id: flake8
exclude: /migrations/
exclude: lesgrandsvoisins/settings/production.py
exclude: |
(?x)(
.*/migrations/.*.py|
lesgrandsvoisins/settings/.*.py|
lesgv/settings/.*.py
)
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
Expand Down
56 changes: 29 additions & 27 deletions lesgrandsvoisins/settings/base_local.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
import os
from dotenv import load_dotenv # Pour les variables d'.env

from dotenv import load_dotenv # Pour les variables d'.env


# Prendre les variables d'environnement
load_dotenv()

AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',

"django.contrib.auth.backends.ModelBackend",
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
"allauth.account.auth_backends.AuthenticationBackend",
)

SOCIALACCOUNT_PROVIDERS = {
'openid_connect': {
"OAUTH_PKCE_ENABLED": True,
# 'SOCIALACCOUNT_ONLY': True,
"APPS": [
{
"provider_id": "key-lesgrandsvoisins-com",
"name": "key.lesgrandsvoisins.com",
"client_id": os.getenv('OPENID_NAME'),
"secret": os.getenv('OPENID_SECRET'),
"settings": {
"server_url": os.getenv('OPENID_URL'),
# Optional token endpoint authentication method.
# May be one of "client_secret_basic", "client_secret_post"
# If omitted, a method from the the server's
# token auth methods list is used
"token_auth_method": "client_secret_post",
},
},
],
}
"openid_connect": {
"OAUTH_PKCE_ENABLED": True,
# 'SOCIALACCOUNT_ONLY': True,
"APPS": [
{
"provider_id": "key-lesgrandsvoisins-com",
"name": "key.lesgrandsvoisins.com",
"client_id": os.getenv("OPENID_NAME"),
"secret": os.getenv("OPENID_SECRET"),
"settings": {
"server_url": os.getenv("OPENID_URL"),
# Optional token endpoint authentication method.
# May be one of "client_secret_basic", "client_secret_post"
# If omitted, a method from the the server's
# token auth methods list is used
"token_auth_method": "client_secret_post",
},
},
],
}
}

# LOGIN_URL = '/login/'
# LOGIN_REDIRECT_URL = '/'
ACCOUNT_AUTHENTICATION_METHOD = "username"
SOCIALACCOUNT_AUTO_SIGNUP = True
ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_EMAIL_VERIFICATION = "none"
SOCIALACCOUNT_ONLY = True
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
# # ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
# ACCOUNT_LOGOUT_ON_GET = True
# # ACCOUNT_LOGOUT_REDIRECT_URL = '/login/'
# ACCOUNT_PRESERVE_USERNAME_CASING = False
# ACCOUNT_SESSION_REMEMBER = True
# # ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE = False
# ACCOUNT_USERNAME_BLACKLIST = ["admin", "god"]
# # ACCOUNT_USERNAME_MIN_LENGTH = 2
# # ACCOUNT_USERNAME_MIN_LENGTH = 2
2 changes: 1 addition & 1 deletion lesgrandsvoisins/settings/dev.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .base import *


# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

Expand All @@ -15,4 +16,3 @@
from .local import *
except ImportError:
pass

1 change: 1 addition & 0 deletions lesgrandsvoisins/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from django.core.wsgi import get_wsgi_application


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lesgrandsvoisins.settings.production")

application = get_wsgi_application()
6 changes: 1 addition & 5 deletions lesgv/image_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@


class FaireMainOriginalImageFormat(Format):

def image_to_html(self, image, alt_text, extra_attributes=None):

# the custom HTML representation of your image here
# in Format, the image's rendition.img_tag(extra_attributes) is used to generate the HTML
# representation
Expand All @@ -15,6 +13,4 @@ def image_to_html(self, image, alt_text, extra_attributes=None):
return custom_html


register_image_format(
FaireMainOriginalImageFormat('original ', 'Original', 'richtext-image', 'original ')
)
register_image_format(FaireMainOriginalImageFormat("original ", "Original", "richtext-image", "original "))
1 change: 0 additions & 1 deletion lesgv/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
Loading

0 comments on commit b068077

Please sign in to comment.