Use password field type for the login form password

This commit is contained in:
Will Daly
2014-10-17 13:41:10 -04:00
parent c1e2674997
commit be0033eefe
3 changed files with 4 additions and 2 deletions

View File

@@ -94,10 +94,11 @@ class InvalidFieldError(Exception):
class FormDescription(object):
"""Generate a JSON representation of a form. """
ALLOWED_TYPES = ["text", "select", "textarea", "checkbox"]
ALLOWED_TYPES = ["text", "select", "textarea", "checkbox", "password"]
ALLOWED_RESTRICTIONS = {
"text": ["min_length", "max_length"],
"password": ["min_length", "max_length"],
}
def __init__(self, method, submit_url):

View File

@@ -596,7 +596,7 @@ class LoginSessionViewTest(ApiTestCase):
{
"name": "password",
"default": "",
"type": "text",
"type": "password",
"required": True,
"label": "Password",
"placeholder": "",

View File

@@ -81,6 +81,7 @@ class LoginSessionView(APIView):
form_desc.add_field(
"password",
label=_(u"Password"),
field_type="password",
restrictions={
"min_length": account_api.PASSWORD_MIN_LENGTH,
"max_length": account_api.PASSWORD_MAX_LENGTH,