fix: 🚪 fix user signup form
This commit is contained in:
parent
21135d2f78
commit
c3f74be09a
2 changed files with 7 additions and 15 deletions
|
|
@ -9,30 +9,22 @@ from moku.models.user import User
|
||||||
|
|
||||||
|
|
||||||
class UserForm(UserCreationForm):
|
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)
|
captcha = ReCaptchaField(required=True)
|
||||||
|
|
||||||
class Meta(UserCreationForm.Meta):
|
class Meta(UserCreationForm.Meta):
|
||||||
model = User
|
model = User
|
||||||
fields = ("username", "email")
|
fields = ("username", "email", "password1", "password2")
|
||||||
labels = {
|
labels = {
|
||||||
"username": _("username"),
|
"username": _("username"),
|
||||||
"email": _("email address"),
|
"email": _("email address"),
|
||||||
|
"password1": _("password"),
|
||||||
|
"password2": _("password (again)"),
|
||||||
}
|
}
|
||||||
help_texts = {
|
help_texts = {
|
||||||
"username": User._meta.get_field("username").help_text,
|
"username": User._meta.get_field("username").help_text,
|
||||||
"email": User._meta.get_field("email").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):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="id_password1">{{ form.password1.label }}</label>
|
<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>
|
<span class="help">{{ form.password1.help_text|safe }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="id_password2">{{ form.password2.label }}</label>
|
<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>
|
<span class="help">{{ form.password2.help_text }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<div class="field">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue