From be0033eefec28c2000571c743b430ace55062d5b Mon Sep 17 00:00:00 2001 From: Will Daly Date: Fri, 17 Oct 2014 13:41:10 -0400 Subject: [PATCH] Use password field type for the login form password --- common/djangoapps/user_api/helpers.py | 3 ++- common/djangoapps/user_api/tests/test_views.py | 2 +- common/djangoapps/user_api/views.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/djangoapps/user_api/helpers.py b/common/djangoapps/user_api/helpers.py index b591e41783..9bc296fe13 100644 --- a/common/djangoapps/user_api/helpers.py +++ b/common/djangoapps/user_api/helpers.py @@ -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): diff --git a/common/djangoapps/user_api/tests/test_views.py b/common/djangoapps/user_api/tests/test_views.py index 3954505428..8d16e02d0f 100644 --- a/common/djangoapps/user_api/tests/test_views.py +++ b/common/djangoapps/user_api/tests/test_views.py @@ -596,7 +596,7 @@ class LoginSessionViewTest(ApiTestCase): { "name": "password", "default": "", - "type": "text", + "type": "password", "required": True, "label": "Password", "placeholder": "", diff --git a/common/djangoapps/user_api/views.py b/common/djangoapps/user_api/views.py index dde98e092e..a35e4cf259 100644 --- a/common/djangoapps/user_api/views.py +++ b/common/djangoapps/user_api/views.py @@ -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,