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,