Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pretix-keycloak-create-user
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
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
Service Desk
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
FS Info TU Dortmund
Administration
pretix-keycloak-create-user
Commits
1149ebbd
Commit
1149ebbd
authored
1 year ago
by
Luca
Browse files
Options
Downloads
Patches
Plain Diff
django 4 compatibility
parent
b4f8c077
No related branches found
No related tags found
No related merge requests found
Pipeline
#181770
failed
1 year ago
Stage: linting
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pretix_keycloak_create_user/forms.py
+9
-9
9 additions, 9 deletions
pretix_keycloak_create_user/forms.py
pretix_keycloak_create_user/signals.py
+5
-5
5 additions, 5 deletions
pretix_keycloak_create_user/signals.py
pretix_keycloak_create_user/urls.py
+3
-3
3 additions, 3 deletions
pretix_keycloak_create_user/urls.py
with
17 additions
and
17 deletions
pretix_keycloak_create_user/forms.py
+
9
−
9
View file @
1149ebbd
from
django.forms
import
CharField
,
CheckboxSelectMultiple
,
MultipleChoiceField
from
django.forms
import
CharField
,
CheckboxSelectMultiple
,
MultipleChoiceField
from
django.utils.translation
import
u
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
from
i18nfield.forms
import
I18nFormField
,
I18nTextInput
from
i18nfield.forms
import
I18nFormField
,
I18nTextInput
from
pretix.base.forms
import
SettingsForm
from
pretix.base.forms
import
SettingsForm
...
@@ -7,26 +7,26 @@ from pretix.base.forms import SettingsForm
...
@@ -7,26 +7,26 @@ from pretix.base.forms import SettingsForm
class
KeycloakCreatorForm
(
SettingsForm
):
class
KeycloakCreatorForm
(
SettingsForm
):
keycloak_create_user_items
=
MultipleChoiceField
(
keycloak_create_user_items
=
MultipleChoiceField
(
widget
=
CheckboxSelectMultiple
(
attrs
=
{
"
class
"
:
"
scrolling-multiple-choice
"
}),
widget
=
CheckboxSelectMultiple
(
attrs
=
{
"
class
"
:
"
scrolling-multiple-choice
"
}),
label
=
_
(
"
Ask Username for
"
),
label
=
gettext_lazy
(
"
Ask Username for
"
),
required
=
True
,
required
=
True
,
choices
=
[],
choices
=
[],
help_text
=
_
(
"
These products will ask for a username.
"
),
help_text
=
gettext_lazy
(
"
These products will ask for a username.
"
),
)
)
keycloak_create_user_authorization_token
=
CharField
(
keycloak_create_user_authorization_token
=
CharField
(
label
=
_
(
"
Access token
"
),
label
=
gettext_lazy
(
"
Access token
"
),
strip
=
True
,
strip
=
True
,
help_text
=
_
(
"
Access token for the keycloak server.
"
),
help_text
=
gettext_lazy
(
"
Access token for the keycloak server.
"
),
)
)
keycloak_create_user_realm_url
=
CharField
(
keycloak_create_user_realm_url
=
CharField
(
label
=
_
(
"
Keycloak realm url
"
),
label
=
gettext_lazy
(
"
Keycloak realm url
"
),
strip
=
True
,
strip
=
True
,
help_text
=
_
(
"
The url to keycloak including realm.
"
),
help_text
=
gettext_lazy
(
"
The url to keycloak including realm.
"
),
)
)
keycloak_create_user_hint
=
I18nFormField
(
keycloak_create_user_hint
=
I18nFormField
(
widget
=
I18nTextInput
,
widget
=
I18nTextInput
,
label
=
_
(
"
Username field help text
"
),
label
=
gettext_lazy
(
"
Username field help text
"
),
required
=
True
,
required
=
True
,
help_text
=
_
(
"
Explains what to enter
"
),
help_text
=
gettext_lazy
(
"
Explains what to enter
"
),
)
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
...
...
This diff is collapsed.
Click to expand it.
pretix_keycloak_create_user/signals.py
+
5
−
5
View file @
1149ebbd
...
@@ -3,7 +3,7 @@ import requests
...
@@ -3,7 +3,7 @@ import requests
from
django
import
forms
from
django
import
forms
from
django.dispatch
import
receiver
from
django.dispatch
import
receiver
from
django.urls
import
resolve
,
reverse
from
django.urls
import
resolve
,
reverse
from
django.utils.translation
import
gettext_noop
,
u
gettext_lazy
as
_
from
django.utils.translation
import
gettext_noop
,
gettext_lazy
from
i18nfield.strings
import
LazyI18nString
from
i18nfield.strings
import
LazyI18nString
from
pretix.base.services.orders
import
OrderError
from
pretix.base.services.orders
import
OrderError
from
pretix.base.settings
import
settings_hierarkey
from
pretix.base.settings
import
settings_hierarkey
...
@@ -42,11 +42,11 @@ def add_keycloak_username_question(sender, position, **kwargs):
...
@@ -42,11 +42,11 @@ def add_keycloak_username_question(sender, position, **kwargs):
return
{
return
{
"
keycloak_create_user_keycloak_username
"
:
forms
.
RegexField
(
"
keycloak_create_user_keycloak_username
"
:
forms
.
RegexField
(
label
=
_
(
"
Username
"
),
label
=
gettext_lazy
(
"
Username
"
),
required
=
False
,
required
=
False
,
regex
=
"
[a-z0-9._=/-]+
"
,
regex
=
"
[a-z0-9._=/-]+
"
,
strip
=
True
,
strip
=
True
,
error_messages
=
{
"
invalid
"
:
_
(
"
Enter a valid username
"
)},
error_messages
=
{
"
invalid
"
:
gettext_lazy
(
"
Enter a valid username
"
)},
help_text
=
rich_text_snippet
(
sender
.
settings
.
keycloak_create_user_hint
),
help_text
=
rich_text_snippet
(
sender
.
settings
.
keycloak_create_user_hint
),
)
)
}
}
...
@@ -83,7 +83,7 @@ def navbar_settings(sender, request=None, **kwargs):
...
@@ -83,7 +83,7 @@ def navbar_settings(sender, request=None, **kwargs):
url
=
resolve
(
request
.
path_info
)
url
=
resolve
(
request
.
path_info
)
return
[
return
[
{
{
"
label
"
:
_
(
"
Create User
"
),
"
label
"
:
gettext_lazy
(
"
Create User
"
),
"
url
"
:
reverse
(
"
url
"
:
reverse
(
"
plugins:pretix_keycloak_create_user:settings
"
,
"
plugins:pretix_keycloak_create_user:settings
"
,
kwargs
=
{
kwargs
=
{
...
@@ -135,4 +135,4 @@ def validate_order(sender, positions, **kwargs):
...
@@ -135,4 +135,4 @@ def validate_order(sender, positions, **kwargs):
if
response
.
status_code
==
200
:
if
response
.
status_code
==
200
:
if
json
.
loads
(
response
.
text
)
>
0
:
if
json
.
loads
(
response
.
text
)
>
0
:
raise
OrderError
(
_
(
"
Username already taken
"
))
raise
OrderError
(
gettext_lazy
(
"
Username already taken
"
))
This diff is collapsed.
Click to expand it.
pretix_keycloak_create_user/urls.py
+
3
−
3
View file @
1149ebbd
from
django.
conf.
urls
import
url
from
django.urls
import
path
from
.views
import
KeycloakCreatorView
from
.views
import
KeycloakCreatorView
urlpatterns
=
[
urlpatterns
=
[
url
(
path
(
r
"
^
control/event/
(?P<
organizer>
[^/]+)/(?P<event>[^/]+)
/keycloak_create_user/
$
"
,
"
control/event/
<str:
organizer>
/<str:event>
/keycloak_create_user/
"
,
KeycloakCreatorView
.
as_view
(),
KeycloakCreatorView
.
as_view
(),
name
=
"
settings
"
,
name
=
"
settings
"
,
)
)
...
...
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