diff --git a/gnuviechadmin/dashboard/templates/dashboard/user_dashboard.html b/gnuviechadmin/dashboard/templates/dashboard/user_dashboard.html index 19d05cd..b468ace 100644 --- a/gnuviechadmin/dashboard/templates/dashboard/user_dashboard.html +++ b/gnuviechadmin/dashboard/templates/dashboard/user_dashboard.html @@ -15,37 +15,20 @@ {% translate "Name" %} - {% translate "Disk space" %} - {% translate "Mailboxes" %} - {% translate "Databases" %} + {% translate "Setup date" %} {% translate "Actions" %} {% for package in hosting_packages %} - {{ package.name }} - - - {% with diskspace=package.get_disk_space %} - {{ diskspace|filesizeformat }} - {% endwith %} - - - {% blocktranslate with num=package.used_mailbox_count total=package.mailbox_count trimmed %} - used {{ num }} of {{ total }} - {% endblocktranslate %} - {% for dbtype in package.get_databases %} - {{ dbtype.number }} - {% include "userdbs/snippets/db_type.html" with db_type=dbtype.db_type %} - {% if not forloop.last %} / {% endif %} - {% endfor %} - + + {{ package.created }} + {% endfor %} diff --git a/gnuviechadmin/dashboard/views.py b/gnuviechadmin/dashboard/views.py index 7f30316..2ed2558 100644 --- a/gnuviechadmin/dashboard/views.py +++ b/gnuviechadmin/dashboard/views.py @@ -4,6 +4,7 @@ This module defines the views for the gnuviechadmin customer dashboard. """ from django.contrib.auth import get_user_model from django.contrib.auth.mixins import LoginRequiredMixin +from django.shortcuts import redirect from django.views.generic import DetailView, TemplateView from gvacommon.viewmixins import StaffOrSelfLoginRequiredMixin @@ -18,6 +19,11 @@ class IndexView(LoginRequiredMixin, TemplateView): template_name = "dashboard/index.html" + def dispatch(self, request, *args, **kwargs): + if not request.user.is_anonymous: + return redirect("customer_dashboard", slug=request.user.username) + return super().dispatch(request, *args, **kwargs) + class UserDashboardView(StaffOrSelfLoginRequiredMixin, DetailView): """ diff --git a/gnuviechadmin/hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html b/gnuviechadmin/hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html index a4b7727..982f700 100644 --- a/gnuviechadmin/hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html +++ b/gnuviechadmin/hostingpackages/templates/hostingpackages/customerhostingpackage_admin_list.html @@ -11,6 +11,9 @@ {% translate "Name" %} {% translate "Customer" %} {% translate "OS User" %} + {% translate "Disk space" %} + {% translate "Mailboxes" %} + {% translate "Databases" %} {% translate "Setup date" %} @@ -21,6 +24,22 @@ {{ package.customer }} + + {% with diskspace=package.get_disk_space %} + {{ diskspace|filesizeformat }} + {% endwith %} + + + {% blocktranslate with num=package.used_mailbox_count total=package.mailbox_count trimmed %} + used {{ num }} of {{ total }} + {% endblocktranslate %} + {% for dbtype in package.get_databases %} + {{ dbtype.number }} + {% include "userdbs/snippets/db_type.html" with db_type=dbtype.db_type %} + {% if not forloop.last %} / {% endif %} + {% endfor %} {{ package.osuser.username }} {{ package.created }} diff --git a/gnuviechadmin/hostingpackages/templates/hostingpackages/customerhostingpackage_list.html b/gnuviechadmin/hostingpackages/templates/hostingpackages/customerhostingpackage_list.html deleted file mode 100644 index 940b2b4..0000000 --- a/gnuviechadmin/hostingpackages/templates/hostingpackages/customerhostingpackage_list.html +++ /dev/null @@ -1,48 +0,0 @@ -{% extends "hostingpackages/base.html" %} -{% load i18n %} -{% block title %}{{ block.super }} - {% spaceless %} - {% if user == customer %} - {% translate "Your hosting packages" %} - {% else %} - {% blocktranslate with customer=customer.get_full_name trimmed %}Hosting Packages of - {{ customer }}{% endblocktranslate %} - {% endif %} -{% endspaceless %}{% endblock title %} - -{% block page_title %}{% spaceless %} - {% if user == customer %} - {% translate "Your hosting packages" %} - {% else %} - {% blocktranslate with customer=customer.get_full_name trimmed %}Hosting Packages - of {{ customer }}{% endblocktranslate %} - {% endif %} -{% endspaceless %}{% endblock page_title %} - -{% block content %} - {% if customerhostingpackage_list %} - - - - - - - - - {% for package in customerhostingpackage_list %} - - - - - {% endfor %} - -
{% translate "Name" %}{% translate "Setup date" %}
{{ package.name }}{{ package.created }}
- {% else %} -

- {% if user == customer %}{% translate "You have no hosting packages setup yet." %}{% else %} - {% translate "There are no hosting packages setup for this customer yet." %}{% endif %}

- {% endif %} - {% if user.is_staff %} -

{% translate "Add hosting package" %}

- {% endif %} -{% endblock content %} diff --git a/gnuviechadmin/hostingpackages/urls.py b/gnuviechadmin/hostingpackages/urls.py index 9f1dfb7..fe3faa6 100644 --- a/gnuviechadmin/hostingpackages/urls.py +++ b/gnuviechadmin/hostingpackages/urls.py @@ -12,7 +12,6 @@ from .views import ( CreateCustomerHostingPackage, CreateHostingPackage, CustomerHostingPackageDetails, - CustomerHostingPackageList, HostingOptionChoices, ) @@ -23,11 +22,6 @@ urlpatterns = [ AllCustomerHostingPackageList.as_view(), name="all_hosting_packages", ), - re_path( - r"^(?P[-\w0-9@.+_]+)/$", - CustomerHostingPackageList.as_view(), - name="hosting_packages", - ), re_path( r"^(?P[-\w0-9@.+_]+)/create$", CreateCustomerHostingPackage.as_view(), diff --git a/gnuviechadmin/hostingpackages/views.py b/gnuviechadmin/hostingpackages/views.py index d94f296..37ff280 100644 --- a/gnuviechadmin/hostingpackages/views.py +++ b/gnuviechadmin/hostingpackages/views.py @@ -149,35 +149,6 @@ class AllCustomerHostingPackageList(StaffUserRequiredMixin, ListView): ) -class CustomerHostingPackageList(StaffOrSelfLoginRequiredMixin, ListView): - """ - This view is used for showing a list of a customer's hosting packages. - - """ - - model = CustomerHostingPackage - customer = None - - def get_customer_object(self): - if self.customer is None: - self.customer = get_object_or_404( - get_user_model(), username=self.kwargs["user"] - ) - return self.customer - - def get_context_data(self, **kwargs): - context = super(CustomerHostingPackageList, self).get_context_data(**kwargs) - context["customer"] = self.get_customer_object() - return context - - def get_queryset(self): - return ( - super(CustomerHostingPackageList, self) - .get_queryset() - .filter(customer__username=self.kwargs["user"]) - ) - - class HostingOptionChoices(StaffUserRequiredMixin, DetailView): """ This view displays choices of hosting options for a customer hosting diff --git a/gnuviechadmin/templates/account/email.html b/gnuviechadmin/templates/account/email.html index fc66cf3..23a15cd 100644 --- a/gnuviechadmin/templates/account/email.html +++ b/gnuviechadmin/templates/account/email.html @@ -4,72 +4,87 @@ {% block page_title %}{% translate "E-mail Addresses" %}{% endblock page_title %} {% block content %} -{% if user.emailaddress_set.all %} -

{% translate 'The following e-mail addresses are associated with your account:' %}

- -{% else %} -

{% translate 'Warning:'%} {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}

-{% endif %} + {% if user.emailaddress_set.all %} +

{% translate 'The following e-mail addresses are associated with your account:' %}

+ + {% else %} +

+ {% translate 'Warning:' %} {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %} +

+ {% endif %} -

{% translate "Add E-mail Address" %}

+

{% translate "Add E-mail Address" %}

-
- {% csrf_token %} - {{ form | crispy }} - -
+
+ {% csrf_token %} + {{ form | crispy }} + +
{% endblock content %} {% block extra_js %} - + {% endblock extra_js %} diff --git a/gnuviechadmin/templates/account/email_confirm.html b/gnuviechadmin/templates/account/email_confirm.html index c91da96..e70246c 100644 --- a/gnuviechadmin/templates/account/email_confirm.html +++ b/gnuviechadmin/templates/account/email_confirm.html @@ -11,7 +11,7 @@ {% endblocktranslate %}

{% csrf_token %} - +
{% else %} {% url 'account_email' as email_url %} diff --git a/gnuviechadmin/templates/account/login.html b/gnuviechadmin/templates/account/login.html index 0a7ccad..bbc211d 100644 --- a/gnuviechadmin/templates/account/login.html +++ b/gnuviechadmin/templates/account/login.html @@ -14,7 +14,7 @@ {% if redirect_field_value %} {% endif %} - {% translate "Forgot Password?" %} + {% translate "Forgot Password?" %} diff --git a/gnuviechadmin/templates/base.html b/gnuviechadmin/templates/base.html index 127b6e1..3e597df 100644 --- a/gnuviechadmin/templates/base.html +++ b/gnuviechadmin/templates/base.html @@ -23,13 +23,7 @@