in between commit

This commit is contained in:
Nico Schottelius 2021-12-12 20:07:32 +01:00
parent 196ab2787e
commit 12ed80292b
5 changed files with 51 additions and 40 deletions

View file

@ -6,6 +6,7 @@ RUN apk add --update --no-cache\
python3-dev\ python3-dev\
&& rm -rf /var/cache/apk/* && rm -rf /var/cache/apk/*
# FIX https://github.com/python-ldap/python-ldap/issues/432
RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so RUN echo 'INPUT ( libldap.so )' > /usr/lib/libldap_r.so
WORKDIR /usr/src/app WORKDIR /usr/src/app

View file

@ -4,6 +4,10 @@ This service runs on [account.ungleich.ch](https://account.ungleich.ch/) and
allows customers manage their ungleich account (register, edit mail & password, allows customers manage their ungleich account (register, edit mail & password,
...). ...).
## v2
* See below ungleichuser/
## Todos for v2: ## Todos for v2:
* Rewrite/create new app Django 4.0 based (ungleichuser) * Rewrite/create new app Django 4.0 based (ungleichuser)
@ -30,42 +34,38 @@ python3 -m venv venv
pip install -r requirements.txt pip install -r requirements.txt
`` ``
* Clone this repository and enter top-level directory.
* (Optional) Setup a Python virtualenv and install dependencies via pip:
- `virtualenv .venv`
- `source .venv/bin/activate`
- `pip install -r requirements.txt`
- Note: you might have to install some OS dependencies (i.e. libldap2, libsasl).
* Configure the `dal` django app (uses the [decouple](https://pypi.org/project/python-decouple/) library underneath)
- Copy `dal/env.sample` to `dal/.env`
- Populate `dal/.env`
## Functionality ## Functionality
- Allow user to register in a specific subtree x Allow user to register in a specific subtree
- Verify that user does not exist in another subtree x Verify that user does not exist in another subtree
- Assign an id x Assign an id
- Allow password reset via Mail - Allow password reset [via Mail?]
- DB usage: for password reset? - DB usage: for password reset?
## Parameters ## Parameters
LDAPSERVER Via environment variables:
## Steps / Views * LDAPSERVERS=".." -- White space separated list of LDAP-Servers
* ADMIN_DN="" -- we use this DN to connect to LDAP
* ADMIN_PASSWORD="" -- we use this password to connect to LDAP
* SECRET_KEY
* DEBUG
* ALLOWED_HOSTS
## Views
### Register view ### Register view
Form: [get] Form: [get]
* captcha?
* username * username
* password1 * password1
* password2 * password2
Post receiver: [post] Post receiver: [post]
* Validation / check if human
* E-Mail verification * E-Mail verification
E-Mail verify: [get] E-Mail verify: [get]
@ -75,13 +75,4 @@ E-Mail verify: [get]
### Password reset view ### Password reset view
* captcha * captcha
* username * username or email
## Tech notes
### django-auth-ldap
Depends on python-ldap, which fails on Alpine at the moment:
* https://django-auth-ldap.readthedocs.io/en/latest/

View file

@ -1,10 +0,0 @@
django==4.0rc1
django-auth-ldap
# To check
django-bootstrap3
django-filter==2.1.0
python-decouple
ldap3
djangorestframework
requests

View file

@ -0,0 +1,11 @@
django==4.0
ldap3
#django-auth-ldap
# To check
# django-bootstrap3
# django-filter==2.1.0
# python-decouple
# djangorestframework
# requests

View file

@ -1,4 +1,22 @@
import django.contrib.auth.forms as forms import django.contrib.auth.forms as forms
class UngleichAuthenticationForm(forms.AuthenticationForm): from django import forms
address = forms.CharField(max_length=45) from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
# class UngleichAuthenticationForm(forms.AuthenticationForm):
# address = forms.CharField(max_length=45)
class NewUserForm(UserCreationForm):
email = forms.EmailField(required=True)
class Meta:
model = User
fields = ("username", "email", "password1", "password2")
def save(self, commit=True):
user = super(NewUserForm, self).save(commit=False)
user.email = self.cleaned_data['email']
if commit:
user.save()
return user