fix: 🚪 fix user signup form

This commit is contained in:
m5ka 2024-03-25 11:58:42 +00:00
parent 21135d2f78
commit c3f74be09a
2 changed files with 7 additions and 15 deletions

View file

@ -9,30 +9,22 @@ from moku.models.user import User
class UserForm(UserCreationForm):
password1 = forms.CharField(
label=_("password"),
strip=False,
widget=forms.PasswordInput(attrs={"autocomplete": "new-password"}),
help_text=_("make a secure password that you've never used before!"),
)
password2 = forms.CharField(
label=_("password (again)"),
widget=forms.PasswordInput(attrs={"autocomplete": "new-password"}),
strip=False,
help_text=_("just type the password again to confirm."),
)
captcha = ReCaptchaField(required=True)
class Meta(UserCreationForm.Meta):
model = User
fields = ("username", "email")
fields = ("username", "email", "password1", "password2")
labels = {
"username": _("username"),
"email": _("email address"),
"password1": _("password"),
"password2": _("password (again)"),
}
help_texts = {
"username": User._meta.get_field("username").help_text,
"email": User._meta.get_field("email").help_text,
"password1": _("make a secure password that you've never used before!"),
"password2": _("just type the password again to confirm"),
}
def __init__(self, *args, **kwargs):

View file

@ -17,12 +17,12 @@
</div>
<div class="field">
<label for="id_password1">{{ form.password1.label }}</label>
<input type="password" name="password1" id="id_password1" value="{{ form.username.value() or "" }}" required>
<input type="password" name="password1" id="id_password1" required>
<span class="help">{{ form.password1.help_text|safe }}</span>
</div>
<div class="field">
<label for="id_password2">{{ form.password2.label }}</label>
<input type="password" name="password2" id="id_password2" value="{{ form.username.value() or "" }}" required>
<input type="password" name="password2" id="id_password2" required>
<span class="help">{{ form.password2.help_text }}</span>
</div>
<div class="field">