You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2018/10/31 20:56:16 UTC

[airavata-django-portal] 02/02: AIRAVATA-2888 Create acct form help text

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git

commit ab73a8a2e357703731b8323dd13bbaf06edef4a0
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Wed Oct 31 16:11:23 2018 -0400

    AIRAVATA-2888 Create acct form help text
---
 django_airavata/apps/auth/forms.py                                  | 6 ++++--
 .../apps/auth/templates/django_airavata_auth/create_account.html    | 6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/auth/forms.py b/django_airavata/apps/auth/forms.py
index 9569af3..2d54d5d 100644
--- a/django_airavata/apps/auth/forms.py
+++ b/django_airavata/apps/auth/forms.py
@@ -23,14 +23,16 @@ class CreateAccountForm(forms.Form):
         widget=forms.TextInput(attrs={'class': 'form-control',
                                       'placeholder': 'Username'}),
         min_length=6,
-        validators=[USERNAME_VALIDATOR])
+        validators=[USERNAME_VALIDATOR],
+        help_text=USERNAME_VALIDATOR.message)
     password = forms.CharField(
         label='Password',
         widget=forms.PasswordInput(attrs={'class': 'form-control',
                                           'placeholder': 'Password'}),
         min_length=8,
         max_length=48,
-        validators=[PASSWORD_VALIDATOR])
+        validators=[PASSWORD_VALIDATOR],
+        help_text=PASSWORD_VALIDATOR.message)
     password_again = forms.CharField(
         label='Password (again)',
         widget=forms.PasswordInput(attrs={'class': 'form-control',
diff --git a/django_airavata/apps/auth/templates/django_airavata_auth/create_account.html b/django_airavata/apps/auth/templates/django_airavata_auth/create_account.html
index 5a943a9..1a03519 100644
--- a/django_airavata/apps/auth/templates/django_airavata_auth/create_account.html
+++ b/django_airavata/apps/auth/templates/django_airavata_auth/create_account.html
@@ -52,8 +52,14 @@
               <input id="{{ field.id_for_label }}" type="{{ field.field.widget.input_type }}"
                 class="form-control{% if field.errors %} is-invalid{% endif %}" name="{{ field.name }}"
                 placeholder="{{ field.field.widget.attrs.placeholder }}"
+                aria-describedby="{{ field.id_for_label }}-help"
                 {% if field.value %} value="{{ field.value }}" {% endif %}
                 {% if field.field.required %} required {% endif %} />
+              {% if field.help_text %}
+              <small id="{{ field.id_for_label }}-help" class="form-text text-muted">
+                {{ field.help_text | escape }}
+              </small>
+              {% endif %}
               <div class="invalid-feedback">
                 {% if field.errors|length == 1 %}
                   {{ field.errors|first| escape }}