Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sebastian Steins
committed
Oct 9, 2019
1 parent
265b42a
commit 3c70997
Showing
108 changed files
with
4,423 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default_app_config = 'accounts.apps.AccountsConfig' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AccountsConfig(AppConfig): | ||
name = 'accounts' | ||
|
||
def ready(self): | ||
from . import receivers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from django import forms | ||
|
||
from .models import CustomUser, Invitation | ||
|
||
class ProfileForm(forms.ModelForm): | ||
class Meta: | ||
model = CustomUser | ||
fields = ['about', 'email'] | ||
|
||
def clean_email(self): | ||
data = self.cleaned_data['email'] | ||
if data: | ||
data = data.lower() | ||
return data | ||
|
||
|
||
class RegisterForm(forms.ModelForm): | ||
MIN_LENGTH = 8 | ||
class Meta: | ||
model = CustomUser | ||
fields = ['username', 'password', 'email'] | ||
widgets = { | ||
'password': forms.PasswordInput(), | ||
} | ||
|
||
def clean_password(self): | ||
password = self.cleaned_data.get('password') | ||
if len(password) < self.MIN_LENGTH: | ||
raise forms.ValidationError("Your password must be at least %d characters long." % self.MIN_LENGTH) | ||
return password | ||
|
||
class CreateInviteForm(forms.ModelForm): | ||
class Meta: | ||
model = Invitation | ||
fields = ['invited_email_address'] | ||
|
||
def clean_invited_email_address(self): | ||
invited_email_address = self.cleaned_data['invited_email_address'] | ||
if invited_email_address: | ||
invited_email_address = invited_email_address.lower() | ||
return invited_email_address | ||
|
||
|
||
class PasswordForgottenForm(forms.Form): | ||
username = forms.CharField() | ||
|
||
class PasswortResetForm(forms.Form): | ||
password = forms.CharField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Generated by Django 2.2.5 on 2019-09-07 12:14 | ||
|
||
import django.contrib.auth.models | ||
import django.contrib.auth.validators | ||
from django.db import migrations, models | ||
import django.utils.timezone | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
('auth', '0011_update_proxy_permissions'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CustomUser', | ||
fields=[ | ||
('password', models.CharField(max_length=128, verbose_name='password')), | ||
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), | ||
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), | ||
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), | ||
('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')), | ||
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), | ||
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), | ||
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), | ||
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), | ||
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('karma', models.IntegerField(default=1)), | ||
('about', models.TextField(default='')), | ||
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), | ||
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), | ||
], | ||
options={ | ||
'verbose_name': 'user', | ||
'verbose_name_plural': 'users', | ||
'abstract': False, | ||
}, | ||
managers=[ | ||
('objects', django.contrib.auth.models.UserManager()), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 2.2.5 on 2019-09-14 12:47 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='customuser', | ||
name='karma', | ||
field=models.IntegerField(default=0), | ||
), | ||
migrations.CreateModel( | ||
name='EmailVerification', | ||
fields=[ | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('changed_at', models.DateTimeField(auto_now=True)), | ||
('verified', models.BooleanField(default=False)), | ||
('verified_at', models.DateTimeField(null=True)), | ||
('email', models.EmailField(max_length=254)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Generated by Django 2.2.5 on 2019-09-14 20:31 | ||
|
||
from django.conf import settings | ||
import django.contrib.auth.models | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import django.db.models.manager | ||
import mptt.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0002_auto_20190914_1247'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelManagers( | ||
name='customuser', | ||
managers=[ | ||
('_tree_manager', django.db.models.manager.Manager()), | ||
('objects', django.contrib.auth.models.UserManager()), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='customuser', | ||
name='level', | ||
field=models.PositiveIntegerField(default=1, editable=False), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='customuser', | ||
name='lft', | ||
field=models.PositiveIntegerField(default=1, editable=False), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='customuser', | ||
name='parent', | ||
field=mptt.fields.TreeForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='invitees', to=settings.AUTH_USER_MODEL), | ||
), | ||
migrations.AddField( | ||
model_name='customuser', | ||
name='rght', | ||
field=models.PositiveIntegerField(default=2, editable=False), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name='customuser', | ||
name='tree_id', | ||
field=models.PositiveIntegerField(db_index=True, default=1, editable=False), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 2.2.5 on 2019-09-15 11:05 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0003_auto_20190914_2031'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Invitation', | ||
fields=[ | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('changed_at', models.DateTimeField(auto_now=True)), | ||
('num_signups', models.PositiveIntegerField(default=1, null=True)), | ||
('invited_email_address', models.EmailField(default=None, max_length=254, null=True)), | ||
('invite_code', models.UUIDField(default=uuid.uuid4, editable=False)), | ||
('inviting_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='customuser', | ||
name='used_invitation', | ||
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='accounts.Invitation'), | ||
), | ||
] |
19 changes: 19 additions & 0 deletions
19
accounts/migrations/0005_emailverification_verification_code.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 2.2.5 on 2019-09-15 13:16 | ||
|
||
from django.db import migrations, models | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0004_auto_20190915_1105'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='emailverification', | ||
name='verification_code', | ||
field=models.UUIDField(default=uuid.uuid4, editable=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 2.2.5 on 2019-09-15 13:21 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0005_emailverification_verification_code'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='customuser', | ||
options={}, | ||
), | ||
migrations.AlterModelManagers( | ||
name='customuser', | ||
managers=[ | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Generated by Django 2.2.5 on 2019-09-23 13:23 | ||
|
||
from django.conf import settings | ||
import django.contrib.auth.models | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0006_auto_20190915_1321'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='customuser', | ||
options={'default_manager_name': 'objects'}, | ||
), | ||
migrations.AlterModelManagers( | ||
name='customuser', | ||
managers=[ | ||
('objects', django.contrib.auth.models.UserManager()), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='PasswordResetRequest', | ||
fields=[ | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('changed_at', models.DateTimeField(auto_now=True)), | ||
('verification_code', models.UUIDField(default=uuid.uuid4, editable=False)), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
Empty file.
Oops, something went wrong.