mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Added custom user login, logout, & registration forms.
This commit is contained in:
37
src/interface/forms.py
Normal file
37
src/interface/forms.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
from django import forms
|
||||||
|
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AuthenticationForm
|
||||||
|
from .models import CustomUser
|
||||||
|
|
||||||
|
|
||||||
|
class CustomUserCreationForm(UserCreationForm):
|
||||||
|
class Meta:
|
||||||
|
model = CustomUser
|
||||||
|
fields = ("username", "email", "facebook", "twitter", "sponsorid", "matrixid")
|
||||||
|
|
||||||
|
|
||||||
|
class CustomUserChangeForm(UserChangeForm):
|
||||||
|
class Meta:
|
||||||
|
model = CustomUser
|
||||||
|
fields = ("username", "email", "facebook", "twitter", "sponsorid", "matrixid")
|
||||||
|
|
||||||
|
|
||||||
|
class CustomUserLoginForm(AuthenticationForm):
|
||||||
|
class Meta:
|
||||||
|
Model = CustomUser
|
||||||
|
fields = ("username", "password")
|
||||||
|
|
||||||
|
|
||||||
|
class SignUpForm(CustomUserCreationForm):
|
||||||
|
username = forms.CharField(max_length=30, required=False, help_text='Required.')
|
||||||
|
email = forms.EmailField(max_length=254, help_text='Not yet required, as I\'m still deciding how to handle mail')
|
||||||
|
matrixid = forms.CharField(max_length=30, required=False, help_text='Optional.')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = CustomUser
|
||||||
|
fields = ("username", "email", "matrixid")
|
||||||
|
|
||||||
|
|
||||||
|
class UserLoginForm(CustomUserLoginForm):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = CustomUser
|
||||||
Reference in New Issue
Block a user