diff --git a/common/djangoapps/student/forms.py b/common/djangoapps/student/forms.py index 329d924510..9f8114a92e 100644 --- a/common/djangoapps/student/forms.py +++ b/common/djangoapps/student/forms.py @@ -128,13 +128,21 @@ def validate_username(username): validator(username) +def contains_html(value): + """ + Validator method to check whether name contains html tags + """ + regex = re.compile('(<|>)', re.UNICODE) + return bool(regex.search(value)) + + def validate_name(name): """ Verifies a Full_Name is valid, raises a ValidationError otherwise. Args: name (unicode): The name to validate. """ - if accounts_settings.api.contains_html(name): + if contains_html(name): raise forms.ValidationError(_('Full Name cannot contain the following characters: < >')) diff --git a/openedx/core/djangoapps/user_api/accounts/api.py b/openedx/core/djangoapps/user_api/accounts/api.py index 7a7a8b0b37..35c54a2185 100644 --- a/openedx/core/djangoapps/user_api/accounts/api.py +++ b/openedx/core/djangoapps/user_api/accounts/api.py @@ -2,7 +2,6 @@ """ Programmatic integration point for User API Accounts sub-application """ -import re import datetime from pytz import UTC @@ -539,14 +538,6 @@ def _get_user_and_profile(username): return existing_user, existing_user_profile -def contains_html(value): - """ - Validator method to check whether name contains html tags - """ - regex = re.compile('(<|>)', re.UNICODE) - return bool(regex.search(value)) - - def _validate(validation_func, err, *args): """Generic validation function that returns default on no errors, but the message associated with the err class