mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
security: Moves input field focus javascript to django forms
Signed-off-by: Prachi Srivastava <prachi.chs.2009@gmail.com> Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
1 parent
f43e185a8c
commit
743d976d50
13 files changed
+23
-44
No files matched your search
@@ -279,6 +279,11 @@ class FirstBootForm(forms.Form):
|
||||
widget=SubdomainWidget(domain=DOMAIN_APPENDIX),
|
||||
help_text=_('The subdomain you want to register'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""Initialize the form."""
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['code'].widget.attrs.update({'autofocus': 'autofocus'})
|
||||
|
||||
def clean_domain(self):
|
||||
"""Append the domain to the users' subdomain"""
|
||||
return self.cleaned_data['domain'] + self.DOMAIN_APPENDIX
|
||||
|
||||
@@ -59,9 +59,3 @@
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block page_js %}
|
||||
<script>
|
||||
$('#id_code').focus();
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user