forked from uncloud/uncloud
cleanup and get login working again
This commit is contained in:
parent
33d56bf083
commit
5b170ed521
7 changed files with 40 additions and 40 deletions
|
@ -2,10 +2,14 @@
|
||||||
Django==4.0
|
Django==4.0
|
||||||
djangorestframework
|
djangorestframework
|
||||||
django-auth-ldap
|
django-auth-ldap
|
||||||
fontawesome-free
|
|
||||||
django-mathfilters
|
|
||||||
|
|
||||||
psycopg2
|
psycopg2
|
||||||
|
|
||||||
|
django-bootstrap-v5
|
||||||
|
|
||||||
|
#fontawesome-free
|
||||||
|
#django-mathfilters
|
||||||
|
|
||||||
|
|
||||||
ldap3
|
ldap3
|
||||||
django-allauth
|
django-allauth
|
||||||
django-compressor
|
django-compressor
|
||||||
|
@ -20,7 +24,7 @@ django-notifications-hq
|
||||||
django-environ
|
django-environ
|
||||||
|
|
||||||
# PDF creating
|
# PDF creating
|
||||||
django-hardcopy
|
#django-hardcopy
|
||||||
|
|
||||||
# schema support
|
# schema support
|
||||||
pyyaml
|
pyyaml
|
||||||
|
@ -35,7 +39,7 @@ django-q
|
||||||
redis
|
redis
|
||||||
|
|
||||||
jinja2
|
jinja2
|
||||||
python-gitlab
|
#python-gitlab
|
||||||
dnspython
|
dnspython
|
||||||
|
|
||||||
git+https://github.com/ungleich/python-oca.git#egg=oca
|
git+https://github.com/ungleich/python-oca.git#egg=oca
|
||||||
|
|
|
@ -61,6 +61,7 @@ INSTALLED_APPS = [
|
||||||
'django.contrib.sites',
|
'django.contrib.sites',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django_extensions',
|
'django_extensions',
|
||||||
|
'bootstrap5',
|
||||||
# 'mathfilters',
|
# 'mathfilters',
|
||||||
# 'compressor',
|
# 'compressor',
|
||||||
# 'wkhtmltopdf',
|
# 'wkhtmltopdf',
|
||||||
|
|
|
@ -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>
|
<!DOCTYPE html>
|
||||||
<html lang="{{LANGUAGE_CODE}}">
|
<html lang="{{LANGUAGE_CODE}}">
|
||||||
<head>
|
<head>
|
||||||
|
@ -11,19 +18,12 @@
|
||||||
uncloud - {% block title %} made in Switzerland {% endblock %}
|
uncloud - {% block title %} made in Switzerland {% endblock %}
|
||||||
</title>
|
</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 %}
|
{% block css_extra %} {% endblock css_extra %}
|
||||||
|
|
||||||
<!-- External Fonts -->
|
{# Load CSS and JavaScript #}
|
||||||
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Rubik:300,300i,400,400i,500,500i,700,700i,900,900i' type='text/css'>
|
{% bootstrap_css %}
|
||||||
|
{% bootstrap_javascript %}
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<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">
|
<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>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||||
<ul class="navbar-nav mr-auto">
|
<ul class="navbar-nav mr-auto">
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<span class="navbar-text">Logged in as {{ user }}. Your balance:
|
<span class="navbar-text">Logged in as {{ user }}. Your balance:
|
||||||
{{ balance }} CHF. </span>
|
{{ balance }} CHF. </span>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{% url 'account_logout' %}">Logout</a>
|
<a class="nav-link" href="{% url 'logout' %}">Logout</a>
|
||||||
</li>
|
</li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{% url 'account_login' %}">Login</a>
|
<a class="nav-link" href="{% url 'login' %}">Login</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{% block content %} {% endblock %}
|
{% block content %} {% endblock %}
|
||||||
</div>
|
</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 %}
|
{% block js_extra %} {% endblock js_extra %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
some convience views provided by
|
some convience views provided by
|
||||||
the <a href="https://www.django-rest-framework.org/">Django Rest
|
the <a href="https://www.django-rest-framework.org/">Django Rest
|
||||||
Framework</a>. You can
|
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>.
|
the source code of uncloud</a>.
|
||||||
<strong>This is a BETA service.</strong> As such, some
|
<strong>This is a BETA service.</strong> As such, some
|
||||||
functionality might not be very sophisticated.
|
functionality might not be very sophisticated.
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<li>First you need
|
<li>First you need
|
||||||
to <a href="https://account.ungleich.ch">register an
|
to <a href="https://account.ungleich.ch">register an
|
||||||
account</a>. If you already have one, you can
|
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
|
<li>If you have forgotten your password or other issues with
|
||||||
logging in, you can contact the ungleich support
|
logging in, you can contact the ungleich support
|
||||||
via <strong>support at ungleich.ch</strong>.
|
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 '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-list' %}">Make a payment or list your payments</a>
|
||||||
<li><a href="{% url 'payment-balance-list' %}">Show your balance</a>
|
<li><a href="{% url 'payment-balance-list' %}">Show your balance</a>
|
||||||
<li><a href="{% url 'machines-list' %}">Show your VM Instances</a>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -166,4 +165,4 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||||
https://docs.djangoproject.com/en/3.0/topics/http/urls/
|
https://docs.djangoproject.com/en/3.0/topics/http/urls/
|
||||||
"""
|
"""
|
||||||
import environ
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -12,17 +12,15 @@ from django.conf.urls.static import static
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
from rest_framework.schemas import get_schema_view
|
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_net import views as netviews
|
||||||
from uncloud_pay import views as payviews
|
from uncloud_pay import views as payviews
|
||||||
from uncloud_vm import views as vmviews
|
from uncloud_vm import views as vmviews
|
||||||
|
from . import views as uncloudviews
|
||||||
#import notifications.urls
|
#import notifications.urls
|
||||||
|
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
|
|
||||||
env = environ.Env()
|
|
||||||
environ.Env.read_env()
|
|
||||||
|
|
||||||
# Beta endpoints
|
# Beta endpoints
|
||||||
router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct')
|
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 = [
|
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(r'api/', include(router.urls), name='api'),
|
||||||
|
|
||||||
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # for login to REST API
|
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # for login to REST API
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
{% extends 'uncloud/base.html' %}
|
{% extends 'uncloud/base.html' %}
|
||||||
|
{% load bootstrap5 %}
|
||||||
|
{% block title %}Welcome to uncloud [beta]{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="intro" class="row">
|
<div id="intro" class="row">
|
||||||
|
@ -15,4 +18,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -8,13 +8,11 @@ from rest_framework.response import Response
|
||||||
|
|
||||||
from .serializers import *
|
from .serializers import *
|
||||||
|
|
||||||
|
|
||||||
class LoginView(auth_views.LoginView):
|
class LoginView(auth_views.LoginView):
|
||||||
template_name = 'uncloud_auth/login.html'
|
template_name = 'uncloud_auth/login.html'
|
||||||
|
|
||||||
class LogoutView(auth_views.LogoutView):
|
class LogoutView(auth_views.LogoutView):
|
||||||
pass
|
pass
|
||||||
# template_name = 'uncloud_auth/logo.html'
|
|
||||||
|
|
||||||
|
|
||||||
class UserViewSet(viewsets.GenericViewSet):
|
class UserViewSet(viewsets.GenericViewSet):
|
||||||
|
|
Loading…
Reference in a new issue