Private
Public Access
Scaffold Django project and add first-run auth flow
Sets up the Evection project structure: split settings supporting both SQLite and PostgreSQL via DATABASE_URL, Celery+Redis wiring, and the planned app layout (accounts, feeds, articles, rules, search, reader, pwa, core). Implements multi-user auth with a FreshRSS-style first-run setup wizard, login/logout, and admin-only user management, covered by automated tests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
986206fe40
commit
c635cd9330
84 files changed
+897
No files matched your search
@@ -0,0 +1,30 @@
|
||||
from django import forms
|
||||
from django.contrib.auth.forms import UsernameField
|
||||
|
||||
from .models import User
|
||||
|
||||
|
||||
class SetupForm(forms.ModelForm):
|
||||
password = forms.CharField(widget=forms.PasswordInput, min_length=8)
|
||||
password_confirm = forms.CharField(widget=forms.PasswordInput, min_length=8)
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ["username", "email"]
|
||||
field_classes = {"username": UsernameField}
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
if cleaned_data.get("password") != cleaned_data.get("password_confirm"):
|
||||
raise forms.ValidationError("Passwords do not match.")
|
||||
return cleaned_data
|
||||
|
||||
|
||||
class CreateUserForm(forms.ModelForm):
|
||||
password = forms.CharField(widget=forms.PasswordInput, min_length=8)
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ["username", "email", "is_staff"]
|
||||
field_classes = {"username": UsernameField}
|
||||
labels = {"is_staff": "Grant admin access"}
|
||||
Reference in new issue
Block a user