Email should *not* be unique

turns out this is jank-city when you try to federate
This commit is contained in:
Mouse Reeve 2020-10-05 14:48:26 -07:00
parent 93738bb48c
commit 0a9809e6b3
5 changed files with 27 additions and 2 deletions

View file

@ -99,7 +99,7 @@ class EditUserForm(CustomForm):
class Meta: class Meta:
model = models.User model = models.User
fields = [ fields = [
'avatar', 'name', 'summary', 'manually_approves_followers' 'avatar', 'name', 'email', 'summary', 'manually_approves_followers'
] ]
help_texts = {f: None for f in fields} help_texts = {f: None for f in fields}

View file

@ -0,0 +1,18 @@
# Generated by Django 3.0.7 on 2020-10-05 21:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookwyrm', '0051_auto_20201005_2142'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(blank=True, max_length=254, verbose_name='email address'),
),
]

View file

@ -18,7 +18,6 @@ class User(OrderedCollectionPageMixin, AbstractUser):
''' a user who wants to read books ''' ''' a user who wants to read books '''
private_key = models.TextField(blank=True, null=True) private_key = models.TextField(blank=True, null=True)
public_key = models.TextField(blank=True, null=True) public_key = models.TextField(blank=True, null=True)
email = models.EmailField(unique=True)
inbox = models.CharField(max_length=255, unique=True) inbox = models.CharField(max_length=255, unique=True)
shared_inbox = models.CharField(max_length=255, blank=True, null=True) shared_inbox = models.CharField(max_length=255, blank=True, null=True)
federated_server = models.ForeignKey( federated_server = models.ForeignKey(

View file

@ -29,6 +29,13 @@
<p class="help is-danger">{{ error | escape }}</p> <p class="help is-danger">{{ error | escape }}</p>
{% endfor %} {% endfor %}
</p> </p>
<p class="block">
<label class="label" for="id_email">Email address:</label>
{{ form.email }}
{% for error in form.email.errors %}
<p class="help is-danger">{{ error | escape }}</p>
{% endfor %}
</p>
<p class="block"> <p class="block">
<label class="checkbox label" for="id_manually_approve_followers"> <label class="checkbox label" for="id_manually_approve_followers">
Manually approve followers: Manually approve followers:

View file

@ -180,6 +180,7 @@ def edit_profile(request):
return TemplateResponse(request, 'edit_user.html', data) return TemplateResponse(request, 'edit_user.html', data)
request.user.name = form.data['name'] request.user.name = form.data['name']
request.user.email = form.data['email']
if 'avatar' in form.files: if 'avatar' in form.files:
# crop and resize avatar upload # crop and resize avatar upload
image = Image.open(form.files['avatar']) image = Image.open(form.files['avatar'])