password field is showing password in plain text
<p>I have used django allauth for user registration and login system. I could show the form by simplifying the lines of code using for loop. I got the right field type(TextInput and PasswordInput) for each field too. However the password field which has PasswordInput shows password in plain text. How can i resolve this?</p>

<p><strong>my signup page(account/signup.html)</strong></p>

<pre><code>&lt;form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}"&gt;
    {% csrf_token %}
     {% for field in form.visible_fields %}
     &lt;div class="form-group"&gt;
        &lt;label for="{{ field.id_for_label}}"&gt;{{field.label}}&lt;/label&gt;
        {{ field.errors.0 }}
        &lt;input type="{{field|input_type}}" name="{{ field.name }}" class="form-control" id="{{ field.id_for_label}}"&gt;
     &lt;/div&gt;
     {% endfor %}
&lt;/form&gt;
</code></pre>

<p><strong>filters.py</strong></p>

<pre><code>from django import template
register = template.Library()

@register.filter('input_type')
def input_type(field):
    print('field',field.field.widget.__class__)
    return field.field.widget.__class__.__name__
</code></pre>

<p>How can i show password in dot? </p>

<p>The password is showing in plain text because you're assigning <code>&lt;input&gt;</code> types incorrectly, therefore not hiding passwords as <code>&lt;input type="password"&gt;</code> does.</p>

<p>From reading the comments, it looks like you're trying to add custom bootstrap classes to the form fields. As <a href="http://stackoverflow.com/users/6663134/anna-vracheva">Anna Vracheva</a> was saying, you can add the class to the fields using the form's <code>__init__</code> method.</p>

<pre><code>from django import forms

class CustomForm("""Whichever class you're inheriting from, probably ModelForm"""):
    # If you're using AllAuth, this is already defined on the form
    password = fields.CharField(widget=forms.PasswordInput) 
    # Or whatever field, for that matter

    def __init__(self, *args, **kwargs):
        super(CustomFieldForm, self).__init__(*args, **kwargs)

        # Option 1 - Assign to only password
        self.fields['password'].widget['class'] = 'form-control'

        # Option 2 - Loop over all fields and assign to all
        for field in self.fields:
            field.widget['class'] = 'form-control'
</code></pre>

<p>Then, instead of manually rendering HTML, let Django's Templates do that:</p>

<pre class="lang-html prettyprint-override"><code>&lt;!-- This --&gt;
{{ field }}
&lt;-- --&gt;
&lt;!-- Instead of this --&gt;
&lt;input type="{{field|input_type}}" name="{{ field.name }}" 
       class="form-control" id="{{ field.id_for_label}}"&gt;
</code></pre>

<p>That should fix any field rendering problems you're having while preserving your form classes.</p>

python django python-3.x django-allauth