Commit 56d55608 by Will Daly

Merge pull request #5714 from edx/will/logistration-email-field

Change field type for email from 'text' to 'email'
parents b14a1291 611e819d
...@@ -95,11 +95,12 @@ class InvalidFieldError(Exception): ...@@ -95,11 +95,12 @@ 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", "password"] ALLOWED_TYPES = ["text", "email", "select", "textarea", "checkbox", "password"]
ALLOWED_RESTRICTIONS = { ALLOWED_RESTRICTIONS = {
"text": ["min_length", "max_length"], "text": ["min_length", "max_length"],
"password": ["min_length", "max_length"], "password": ["min_length", "max_length"],
"email": ["min_length", "max_length"],
} }
OVERRIDE_FIELD_PROPERTIES = [ OVERRIDE_FIELD_PROPERTIES = [
......
...@@ -600,7 +600,7 @@ class LoginSessionViewTest(ApiTestCase): ...@@ -600,7 +600,7 @@ class LoginSessionViewTest(ApiTestCase):
{ {
"name": "email", "name": "email",
"defaultValue": "", "defaultValue": "",
"type": "text", "type": "email",
"required": True, "required": True,
"label": "E-mail", "label": "E-mail",
"placeholder": "example: username@domain.com", "placeholder": "example: username@domain.com",
...@@ -763,7 +763,7 @@ class RegistrationViewTest(ApiTestCase): ...@@ -763,7 +763,7 @@ class RegistrationViewTest(ApiTestCase):
{ {
u"name": u"email", u"name": u"email",
u"defaultValue": u"", u"defaultValue": u"",
u"type": u"text", u"type": u"email",
u"required": True, u"required": True,
u"label": u"E-mail", u"label": u"E-mail",
u"placeholder": u"example: username@domain.com", u"placeholder": u"example: username@domain.com",
...@@ -854,7 +854,7 @@ class RegistrationViewTest(ApiTestCase): ...@@ -854,7 +854,7 @@ class RegistrationViewTest(ApiTestCase):
{ {
u"name": u"email", u"name": u"email",
u"defaultValue": u"bob@example.com", u"defaultValue": u"bob@example.com",
u"type": u"text", u"type": u"email",
u"required": True, u"required": True,
u"label": u"E-mail", u"label": u"E-mail",
u"placeholder": u"example: username@domain.com", u"placeholder": u"example: username@domain.com",
......
...@@ -75,6 +75,7 @@ class LoginSessionView(APIView): ...@@ -75,6 +75,7 @@ class LoginSessionView(APIView):
form_desc.add_field( form_desc.add_field(
"email", "email",
field_type="email",
label=_(u"E-mail"), label=_(u"E-mail"),
placeholder=_(u"example: username@domain.com"), placeholder=_(u"example: username@domain.com"),
instructions=_( instructions=_(
...@@ -252,6 +253,7 @@ class RegistrationView(APIView): ...@@ -252,6 +253,7 @@ class RegistrationView(APIView):
def _add_email_field(self, form_desc, required=True): def _add_email_field(self, form_desc, required=True):
form_desc.add_field( form_desc.add_field(
"email", "email",
field_type="email",
label=_(u"E-mail"), label=_(u"E-mail"),
placeholder=_(u"example: username@domain.com"), placeholder=_(u"example: username@domain.com"),
instructions=_( instructions=_(
......
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