diff --git a/.env-sample b/.env-sample
index 99116ca..4320203 100644
--- a/.env-sample
+++ b/.env-sample
@@ -1,2 +1,3 @@
export DATABASE_URL=""
export db=""
+export OIDC_RSA_PRIVATE_KEY=""
diff --git a/.gitignore b/.gitignore
index d52c580..34c73b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -151,3 +151,4 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
+keys
diff --git a/accounts/__init__.py b/accounts/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/accounts/admin.py b/accounts/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/accounts/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/accounts/apps.py b/accounts/apps.py
new file mode 100644
index 0000000..3e3c765
--- /dev/null
+++ b/accounts/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class AccountsConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'accounts'
diff --git a/accounts/migrations/__init__.py b/accounts/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/accounts/models.py b/accounts/models.py
new file mode 100644
index 0000000..71a8362
--- /dev/null
+++ b/accounts/models.py
@@ -0,0 +1,3 @@
+from django.db import models
+
+# Create your models here.
diff --git a/accounts/templates/accounts/auth/base.html b/accounts/templates/accounts/auth/base.html
new file mode 100644
index 0000000..74371b6
--- /dev/null
+++ b/accounts/templates/accounts/auth/base.html
@@ -0,0 +1,29 @@
+{% extends "common/components/base.html" %}
+{% block title %}{% block title_name %} {% endblock %} | Hostea Dashbaord{% endblock %}
+{% block nav %} {% include "common/components/nav/pub.html" %} {% endblock %}
+
+{% block main %}
+
+
+
+
Free Forge Ecosystem for Free Developers
+
+ Hostea is a self-hostable libre software development suite comprising Gitea, Woodpecker CI, Librepages and GitPad with payments integration.
+
+
+ - Fully managed
+ - 100% Free Software
+ - Fully Self-Hostable
+ - Observable and reliable
+ - Federation when available
+ - Radically transparent
+ - Horizontal community
+ - Run Hostea and become a service provider!
+
+
+
+
+ {% block login %} {% endblock %}
+
+
+{% endblock %}
diff --git a/accounts/templates/accounts/auth/login.html b/accounts/templates/accounts/auth/login.html
new file mode 100644
index 0000000..97ec0c8
--- /dev/null
+++ b/accounts/templates/accounts/auth/login.html
@@ -0,0 +1,40 @@
+{% extends 'accounts/auth/base.html' %}
+{% block login %}
+
Login
+
+
+ New to Hostea?
+ Create an account
+
+{% endblock %}
diff --git a/accounts/templates/accounts/auth/register.html b/accounts/templates/accounts/auth/register.html
new file mode 100644
index 0000000..5a3b17a
--- /dev/null
+++ b/accounts/templates/accounts/auth/register.html
@@ -0,0 +1,74 @@
+{% extends 'authbase' %}
+{% block title_name %}Sign Up {% endblock %}
+{% block login %}
+Sign Up
+
+
+
+ Already have an account?
+ Login
+
+{% include "demo_banner" %}
+{% endblock %}
diff --git a/accounts/templates/accounts/protected.html b/accounts/templates/accounts/protected.html
new file mode 100644
index 0000000..36ff7c2
--- /dev/null
+++ b/accounts/templates/accounts/protected.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Document
+
+
+
+
+
diff --git a/accounts/templates/accounts/public.html b/accounts/templates/accounts/public.html
new file mode 100644
index 0000000..33bbc26
--- /dev/null
+++ b/accounts/templates/accounts/public.html
@@ -0,0 +1,18 @@
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
diff --git a/accounts/templates/common/components/base.html b/accounts/templates/common/components/base.html
new file mode 100644
index 0000000..ed4da27
--- /dev/null
+++ b/accounts/templates/common/components/base.html
@@ -0,0 +1,15 @@
+
+{% load static %}
+
+
+
+
+ {% block title %} {% endblock %}
+ {% include "common/components/meta.html" %}
+
+
+ {% block nav %} {% endblock %}
+ {% block main %} {% endblock %}
+ {% include "common/components/footer.html" %}
+
+
diff --git a/accounts/templates/common/components/error.html b/accounts/templates/common/components/error.html
new file mode 100644
index 0000000..bb36399
--- /dev/null
+++ b/accounts/templates/common/components/error.html
@@ -0,0 +1,6 @@
+{% if error %}
+
+
ERROR: {{ error.title }}
+
{{ error.reason }}
+
+{% endif %}
diff --git a/accounts/templates/common/components/footer.html b/accounts/templates/common/components/footer.html
new file mode 100644
index 0000000..2004b55
--- /dev/null
+++ b/accounts/templates/common/components/footer.html
@@ -0,0 +1,42 @@
+
diff --git a/accounts/templates/common/components/meta.html b/accounts/templates/common/components/meta.html
new file mode 100644
index 0000000..dca8d2d
--- /dev/null
+++ b/accounts/templates/common/components/meta.html
@@ -0,0 +1,98 @@
+{% load static %}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/accounts/templates/common/components/nav/base.html b/accounts/templates/common/components/nav/base.html
new file mode 100644
index 0000000..c3ad394
--- /dev/null
+++ b/accounts/templates/common/components/nav/base.html
@@ -0,0 +1,18 @@
+
diff --git a/accounts/templates/common/components/nav/pub.html b/accounts/templates/common/components/nav/pub.html
new file mode 100644
index 0000000..35dcddf
--- /dev/null
+++ b/accounts/templates/common/components/nav/pub.html
@@ -0,0 +1,29 @@
+{% load static %}
+
diff --git a/accounts/tests.py b/accounts/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/accounts/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/accounts/urls.py b/accounts/urls.py
new file mode 100644
index 0000000..a7df04b
--- /dev/null
+++ b/accounts/urls.py
@@ -0,0 +1,11 @@
+from django.contrib import admin
+from django.urls import path, include
+
+from .views import login_view, public_view, logout_view, protected_view
+
+urlpatterns = [
+ path('login/', login_view, name='accounts.login'),
+ path('logout/', login_view, name='accounts.logout'),
+ path('protected/', protected_view, name='accounts.protected'),
+ path('', public_view, name='accounts.public'),
+]
diff --git a/accounts/views.py b/accounts/views.py
new file mode 100644
index 0000000..8e9b64f
--- /dev/null
+++ b/accounts/views.py
@@ -0,0 +1,63 @@
+from django.shortcuts import render, redirect
+from django.contrib.auth import authenticate, login, logout
+from django.contrib.auth.decorators import login_required
+from django.http import HttpResponse
+from django.views.decorators.csrf import csrf_protect
+from django.urls import reverse
+
+GREETINGS = {
+ "greeting": "Welcome to Hostea - Free Forge Ecosystem for Free Developers",
+ "features": [
+ "Fully managed",
+ "100% Free Software",
+ "Fully Self-Hostable",
+ "Observable and reliable",
+ "Federation when available",
+ "Radically transparent",
+ "Horizontal community",
+ "Run Hostea and become a service provider!",
+ ],
+}
+
+LOGIN_CONTENT = {
+ "login_name": "Username or Email",
+ "action": "Login",
+ "password": "Password",
+ "forgot_password": "Forgot password?",
+ "register_prompt": "New to Hostea?",
+ "register_action_link_text": "Create an account",
+ "greetings": GREETINGS,
+}
+
+@csrf_protect
+def login_view(request):
+ if request.method == "POST":
+ user = authenticate(request, username=request.POST["username"], password=request.POST["password"])
+ if user is not None:
+ login(request, user)
+ print("user logged in")
+ if "next" in request.POST:
+ next_url = request.POST["next"]
+ if next_url:
+ return redirect(next_url)
+ return redirect(reverse('accounts.protected'))
+ else:
+ return HttpResponse("Login required")
+
+ ctx = LOGIN_CONTENT
+ if "next" in request.GET:
+ ctx["next"] = request.GET["next"]
+
+ return render(request, "accounts/auth/login.html", ctx)
+
+@login_required
+def protected_view(request):
+ return render(request, "accounts/protected.html")
+
+@login_required
+def logout_view(request):
+ logout(request)
+ return redirect(reverse('accounts.login'))
+
+def public_view(request):
+ return render(request, "accounts/public.html")
diff --git a/requirements.txt b/requirements.txt
index 098eb48..da23acc 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,24 +1,38 @@
asgiref==3.5.0
astroid==2.9.3
black==22.1.0
+certifi==2022.5.18.1
+cffi==1.15.0
+charset-normalizer==2.0.12
click==8.0.4
+cryptography==37.0.2
+Deprecated==1.2.13
Django==4.0.3
django-environ==0.8.1
+django-oauth-toolkit==2.0.0
+djangorestframework==3.13.1
greenlet==1.1.2
+idna==3.3
isort==5.10.1
jedi==0.18.1
+jwcrypto==1.3.1
lazy-object-proxy==1.7.1
mccabe==0.6.1
msgpack==1.0.3
mypy-extensions==0.4.3
+oauthlib==3.2.0
parso==0.8.3
pathspec==0.9.0
platformdirs==2.5.1
psycopg2==2.9.3
+pycparser==2.21
pylint==2.12.2
pynvim==0.4.3
+pytz==2022.1
+requests==2.27.1
sqlparse==0.4.2
tblib==1.7.0
toml==0.10.2
tomli==2.0.1
+urllib3==1.26.9
wrapt==1.13.3