diff --git a/common/djangoapps/user_api/helpers.py b/common/djangoapps/user_api/helpers.py index f98f8996a8..0c659dc623 100644 --- a/common/djangoapps/user_api/helpers.py +++ b/common/djangoapps/user_api/helpers.py @@ -95,11 +95,12 @@ class InvalidFieldError(Exception): class FormDescription(object): """Generate a JSON representation of a form. """ - ALLOWED_TYPES = ["text", "select", "textarea", "checkbox", "password"] + ALLOWED_TYPES = ["text", "email", "select", "textarea", "checkbox", "password"] ALLOWED_RESTRICTIONS = { "text": ["min_length", "max_length"], "password": ["min_length", "max_length"], + "email": ["min_length", "max_length"], } OVERRIDE_FIELD_PROPERTIES = [ diff --git a/common/djangoapps/user_api/tests/test_views.py b/common/djangoapps/user_api/tests/test_views.py index f84420ee79..4ffe53c579 100644 --- a/common/djangoapps/user_api/tests/test_views.py +++ b/common/djangoapps/user_api/tests/test_views.py @@ -600,7 +600,7 @@ class LoginSessionViewTest(ApiTestCase): { "name": "email", "defaultValue": "", - "type": "text", + "type": "email", "required": True, "label": "E-mail", "placeholder": "example: username@domain.com", @@ -763,7 +763,7 @@ class RegistrationViewTest(ApiTestCase): { u"name": u"email", u"defaultValue": u"", - u"type": u"text", + u"type": u"email", u"required": True, u"label": u"E-mail", u"placeholder": u"example: username@domain.com", @@ -854,7 +854,7 @@ class RegistrationViewTest(ApiTestCase): { u"name": u"email", u"defaultValue": u"bob@example.com", - u"type": u"text", + u"type": u"email", u"required": True, u"label": u"E-mail", u"placeholder": u"example: username@domain.com", diff --git a/common/djangoapps/user_api/views.py b/common/djangoapps/user_api/views.py index a0a8cfd19a..6cda635a2b 100644 --- a/common/djangoapps/user_api/views.py +++ b/common/djangoapps/user_api/views.py @@ -75,6 +75,7 @@ class LoginSessionView(APIView): form_desc.add_field( "email", + field_type="email", label=_(u"E-mail"), placeholder=_(u"example: username@domain.com"), instructions=_( @@ -252,6 +253,7 @@ class RegistrationView(APIView): def _add_email_field(self, form_desc, required=True): form_desc.add_field( "email", + field_type="email", label=_(u"E-mail"), placeholder=_(u"example: username@domain.com"), instructions=_(