diff --git a/src/servala/core/models/organization.py b/src/servala/core/models/organization.py index 0419175..fec3fa4 100644 --- a/src/servala/core/models/organization.py +++ b/src/servala/core/models/organization.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ @@ -34,18 +33,6 @@ class Organization(ServalaModelMixin, models.Model): user=user, organization=self, role=OrganizationRole.OWNER ) - @classmethod - def create_organization(cls, instance, owner): - try: - instance.origin - except Exception: - instance.origin = OrganizationOrigin.objects.get( - pk=settings.SERVALA_DEFAULT_ORIGIN - ) - instance.save() - instance.set_owner(owner) - return instance - class Meta: verbose_name = _("Organization") verbose_name_plural = _("Organizations") diff --git a/src/servala/frontend/forms/auth.py b/src/servala/frontend/forms/auth.py deleted file mode 100644 index 3bd8a89..0000000 --- a/src/servala/frontend/forms/auth.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.forms import Form - -from servala.core.models.user import User - - -class ServalaSignupForm(Form): - company = User._meta.get_field("company").formfield() - - def signup(self, request, user): - user.company = self.cleaned_data.get("company") - user.save() diff --git a/src/servala/frontend/templates/frontend/base.html b/src/servala/frontend/templates/frontend/base.html index 4aa4da7..80dd44e 100644 --- a/src/servala/frontend/templates/frontend/base.html +++ b/src/servala/frontend/templates/frontend/base.html @@ -20,11 +20,6 @@
{% include 'includes/sidebar.html' %}
-
- - - -

{% block page_title %} diff --git a/src/servala/frontend/templates/frontend/forms/vertical_field.html b/src/servala/frontend/templates/frontend/forms/vertical_field.html index a2457d9..22562d0 100644 --- a/src/servala/frontend/templates/frontend/forms/vertical_field.html +++ b/src/servala/frontend/templates/frontend/forms/vertical_field.html @@ -1,18 +1,23 @@ {% load i18n %}
-
+
{% if field.field.widget.input_type != "checkbox" or field.field.widget.allow_multiple_selected %} - + {% endif %} {% if field.use_fieldset %}
{% endif %} {{ field }} {% if field.field.widget.input_type == "checkbox" and not field.field.widget.allow_multiple_selected %} - + {% endif %} {% if field.use_fieldset %}
{% endif %} - {% for text in field.errors %}
{{ text }}
{% endfor %} + {% for text in field.errors %}
{{ text }}
{% endfor %} {% if field.help_text %} {{ field.help_text|safe }} diff --git a/src/servala/frontend/templates/frontend/profile.html b/src/servala/frontend/templates/frontend/profile.html index 9532e96..a14d730 100644 --- a/src/servala/frontend/templates/frontend/profile.html +++ b/src/servala/frontend/templates/frontend/profile.html @@ -1,5 +1,5 @@ {% extends "frontend/base.html" %} -{% load i18n static %} +{% load i18n %} {% block html_title %} {% block page_title %} {% translate "Profile" %} @@ -10,63 +10,28 @@

{% translate "Account" %}

{% endblock %} -{% block content %} -
-
-
-
-
-

{% translate "Profile" %}

-
-
-
-
- - - - - - - - - - - - - - - - - - - -
{% translate "E-mail" %}{{ request.user.email }}
{% translate "First name" %}{{ request.user.first_name }}
{% translate "Last name" %}{{ request.user.last_name }}
{% translate "Company" %}{{ request.user.company }}
-
-
-
-
-
-
-
-
-

{% translate "Account" %}

-
-
-
-

- {% blocktranslate trimmed %} - You are logged in with your VSHN user account. Change your password and other account data here: - {% endblocktranslate %} -

- - - {% translate "VSHN Account" %} - -
-
-
-
-
-
-{% endblock content %} +{% block card_content %} +

+ {% blocktranslate trimmed %} + You are logged in with your VSHN user account. You will be able to change your password and other settings here in the future. + {% endblocktranslate %} +

+
+ + + + + + + + + + + + + + + +
{% translate "E-mail" %}{{ request.user.email }}
{% translate "First name" %}{{ request.user.first_name }}
{% translate "Last name" %}{{ request.user.last_name }}
+
+{% endblock card_content %} diff --git a/src/servala/frontend/views/generic.py b/src/servala/frontend/views/generic.py index 3b2196b..8b0271e 100644 --- a/src/servala/frontend/views/generic.py +++ b/src/servala/frontend/views/generic.py @@ -1,4 +1,3 @@ -from django.conf import settings from django.views.generic import TemplateView @@ -8,14 +7,3 @@ class IndexView(TemplateView): class ProfileView(TemplateView): template_name = "frontend/profile.html" - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - keycloak_server_url = settings.SOCIALACCOUNT_PROVIDERS["openid_connect"][ - "APPS" - ][0]["settings"]["server_url"] - account_url = keycloak_server_url.replace( - "/.well-known/openid-configuration", "/account" - ) - context["account_href"] = account_url - return context diff --git a/src/servala/frontend/views/organization.py b/src/servala/frontend/views/organization.py index 020d28b..9bc1397 100644 --- a/src/servala/frontend/views/organization.py +++ b/src/servala/frontend/views/organization.py @@ -8,7 +8,8 @@ class OrganizationCreateView(FormView): template_name = "frontend/organizations/create.html" def form_valid(self, form): - form.instance.create_organization(form.instance, owner=self.request.user) + form.save() + form.instance.set_owner(self.request.user) return super().form_valid(form) def get_success_url(self): diff --git a/src/servala/settings.py b/src/servala/settings.py index 0df8059..36d7673 100644 --- a/src/servala/settings.py +++ b/src/servala/settings.py @@ -164,7 +164,6 @@ ACCOUNT_USER_MODEL_USERNAME_FIELD = None ACCOUNT_UNIQUE_EMAIL = True ACCOUNT_LOGIN_METHODS = {"email"} ACCOUNT_SIGNUP_FIELDS = ["email*", "password1*", "password2*"] -ACCOUNT_SIGNUP_FORM_CLASS = "servala.frontend.forms.auth.ServalaSignupForm" AUTHENTICATION_BACKENDS = [ # Needed to login by username in Django admin, regardless of `allauth` diff --git a/src/servala/urls.py b/src/servala/urls.py index c37e288..d1d40ec 100644 --- a/src/servala/urls.py +++ b/src/servala/urls.py @@ -14,12 +14,12 @@ admin.site.index_title = _("Dashboard") admin.site.login = secure_admin_login(admin.site.login) urlpatterns = [ + path("admin/", admin.site.urls), path("", include((urls, "servala.frontend"), namespace="frontend")), # This adds the allauth urls to the project: # - accounts/keycloak/login/ # - accounts/keycloak/login/callback/ path("accounts/", include("allauth.urls")), - path("admin/", admin.site.urls), ] # Serve static and media files in development