alevchuk / ln-central

ln-central is Q&A website powered by lightning network
Other
1 stars 1 forks source link

form validation error for invalid sig #27

Open alevchuk opened 4 years ago

alevchuk commented 4 years ago

When signature is invalid we default back to anonymous account. this can confuse users (e.g. when they are trying to sign an ofd memo). instead we should display the usual "Errors Detected" form validation and say something like "Signature is invalid. Try signing latest preview data or delete signature to be anonymous."

This should probably use add_error https://docs.djangoproject.com/en/2.2/ref/forms/api/#django.forms.Form.add_error because making it a regular field validator seems to be impossible because this check requires access to multiple fields. We could also make it a non-field error yet that will not highlight the sig text box.

This is blocked by migration to Django 2 or 3, because 1.6 does not have add_error in forms https://django.readthedocs.io/en/1.6.x/intro/tutorial01.html

alevchuk commented 4 years ago

432ba28 is a workaround, we should remove the hack and use add_error after upgrading Django