Commit 3c1aab80 by Will Daly

Merge pull request #5622 from edx/will/set-password-field-type

Use password field type for the login form password
parents c1e26749 be0033ee
...@@ -94,10 +94,11 @@ class InvalidFieldError(Exception): ...@@ -94,10 +94,11 @@ class InvalidFieldError(Exception):
class FormDescription(object): class FormDescription(object):
"""Generate a JSON representation of a form. """ """Generate a JSON representation of a form. """
ALLOWED_TYPES = ["text", "select", "textarea", "checkbox"] ALLOWED_TYPES = ["text", "select", "textarea", "checkbox", "password"]
ALLOWED_RESTRICTIONS = { ALLOWED_RESTRICTIONS = {
"text": ["min_length", "max_length"], "text": ["min_length", "max_length"],
"password": ["min_length", "max_length"],
} }
def __init__(self, method, submit_url): def __init__(self, method, submit_url):
......
...@@ -596,7 +596,7 @@ class LoginSessionViewTest(ApiTestCase): ...@@ -596,7 +596,7 @@ class LoginSessionViewTest(ApiTestCase):
{ {
"name": "password", "name": "password",
"default": "", "default": "",
"type": "text", "type": "password",
"required": True, "required": True,
"label": "Password", "label": "Password",
"placeholder": "", "placeholder": "",
......
...@@ -81,6 +81,7 @@ class LoginSessionView(APIView): ...@@ -81,6 +81,7 @@ class LoginSessionView(APIView):
form_desc.add_field( form_desc.add_field(
"password", "password",
label=_(u"Password"), label=_(u"Password"),
field_type="password",
restrictions={ restrictions={
"min_length": account_api.PASSWORD_MIN_LENGTH, "min_length": account_api.PASSWORD_MIN_LENGTH,
"max_length": account_api.PASSWORD_MAX_LENGTH, "max_length": account_api.PASSWORD_MAX_LENGTH,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment