cleanup and get login working again

This commit is contained in:
Nico Schottelius 2021-12-26 21:19:03 +01:00
parent 33d56bf083
commit 5b170ed521
7 changed files with 40 additions and 40 deletions

View file

@ -2,10 +2,14 @@
Django==4.0
djangorestframework
django-auth-ldap
fontawesome-free
django-mathfilters
psycopg2
django-bootstrap-v5
#fontawesome-free
#django-mathfilters
ldap3
django-allauth
django-compressor
@ -20,7 +24,7 @@ django-notifications-hq
django-environ
# PDF creating
django-hardcopy
#django-hardcopy
# schema support
pyyaml
@ -35,7 +39,7 @@ django-q
redis
jinja2
python-gitlab
#python-gitlab
dnspython
git+https://github.com/ungleich/python-oca.git#egg=oca

View file

@ -61,6 +61,7 @@ INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.staticfiles',
'django_extensions',
'bootstrap5',
# 'mathfilters',
# 'compressor',
# 'wkhtmltopdf',

View file

@ -1,4 +1,11 @@
{% load static i18n %} {% get_current_language as LANGUAGE_CODE %}
{% load static i18n %}
{% load bootstrap5 %}
{# Display django.contrib.messages as Bootstrap alerts #}
{% bootstrap_messages %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="{{LANGUAGE_CODE}}">
<head>
@ -11,19 +18,12 @@
uncloud - {% block title %} made in Switzerland {% endblock %}
</title>
<!-- Vendor CSS -->
<!-- Bootstrap Core CSS -->
<link href="{% static 'matrixhosting/css/bootstrap.min.css' %}" rel="stylesheet" />
<!-- Icon Fonts -->
<link
href="{% static 'matrixhosting/css/fontawesome-all.min.css' %}"
rel="stylesheet"
type="text/css"
/>
{% block css_extra %} {% endblock css_extra %}
<!-- External Fonts -->
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Rubik:300,300i,400,400i,500,500i,700,700i,900,900i' type='text/css'>
{# Load CSS and JavaScript #}
{% bootstrap_css %}
{% bootstrap_javascript %}
</head>
<body>
@ -34,34 +34,27 @@
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
{% if user.is_authenticated %}
<span class="navbar-text">Logged in as {{ user }}. Your balance:
{{ balance }} CHF. </span>
<li class="nav-item">
<a class="nav-link" href="{% url 'account_logout' %}">Logout</a>
<a class="nav-link" href="{% url 'logout' %}">Logout</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'account_login' %}">Login</a>
<a class="nav-link" href="{% url 'login' %}">Login</a>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>
{% block content %} {% endblock %}
{% block content %} {% endblock %}
</div>
<!-- jQuery -->
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"
></script>
<script src="{% static 'matrixhosting/js/bootstrap.bundle.min.js' %}"></script>
{% block js_extra %} {% endblock js_extra %}
</body>
</html>

View file

@ -19,7 +19,7 @@
some convience views provided by
the <a href="https://www.django-rest-framework.org/">Django Rest
Framework</a>. You can
freely <a href="https://code.ungleich.ch/uncloud/uncloud/">access
freely <a href="https://code.ungleich.ch/uncloud/uncloud">access
the source code of uncloud</a>.
<strong>This is a BETA service.</strong> As such, some
functionality might not be very sophisticated.
@ -37,7 +37,7 @@
<li>First you need
to <a href="https://account.ungleich.ch">register an
account</a>. If you already have one, you can
<a href="{% url 'account_login' %}">login</a>.
<a href="{% url 'login' %}">login</a>.
<li>If you have forgotten your password or other issues with
logging in, you can contact the ungleich support
via <strong>support at ungleich.ch</strong>.
@ -110,7 +110,6 @@
<li><a href="{% url 'bills-list' %}">List your Bills</a>
<li><a href="{% url 'payment-list' %}">Make a payment or list your payments</a>
<li><a href="{% url 'payment-balance-list' %}">Show your balance</a>
<li><a href="{% url 'machines-list' %}">Show your VM Instances</a>
</ul>
</div>
</div>
@ -166,4 +165,4 @@
{% endif %}
</div>
</div>
{% endblock %}
{% endblock %}

View file

@ -3,7 +3,7 @@
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
"""
import environ
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
@ -12,17 +12,15 @@ from django.conf.urls.static import static
from rest_framework import routers
from rest_framework.schemas import get_schema_view
#from opennebula import views as oneviews
from uncloud_auth import views as authviews
from uncloud_net import views as netviews
from uncloud_pay import views as payviews
from uncloud_vm import views as vmviews
from . import views as uncloudviews
#import notifications.urls
router = routers.DefaultRouter()
env = environ.Env()
environ.Env.read_env()
# Beta endpoints
router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct')
@ -46,6 +44,10 @@ router.register(r'v2/generic/vat-rate', payviews.VATRateViewSet, basename='vatra
urlpatterns = [
path(r'', uncloudviews.UncloudIndex.as_view(), name='uncloudindex'),
path(r'^/login', authviews.LoginView.as_view(), name='login'),
path(r'^/logout', authviews.LogoutView.as_view(), name='logout'),
path(r'api/', include(router.urls), name='api'),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # for login to REST API

View file

@ -1,5 +1,8 @@
{% extends 'uncloud/base.html' %}
{% load bootstrap5 %}
{% block title %}Welcome to uncloud [beta]{% endblock %}
{% block content %}
<div class="container">
<div id="content">
<div id="intro" class="row">
@ -15,4 +18,4 @@
</div>
</div>
</div>
{% endblock %}

View file

@ -8,13 +8,11 @@ from rest_framework.response import Response
from .serializers import *
class LoginView(auth_views.LoginView):
template_name = 'uncloud_auth/login.html'
class LogoutView(auth_views.LogoutView):
pass
# template_name = 'uncloud_auth/logo.html'
class UserViewSet(viewsets.GenericViewSet):