chore: Handle forbidden username exceptions on registration (#1545)
This commit is contained in:
@@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { windowScrollTo } from '../../data/utils';
|
import { windowScrollTo } from '../../data/utils';
|
||||||
import {
|
import {
|
||||||
FORBIDDEN_REQUEST,
|
FORBIDDEN_REQUEST,
|
||||||
|
FORBIDDEN_USERNAME,
|
||||||
INTERNAL_SERVER_ERROR,
|
INTERNAL_SERVER_ERROR,
|
||||||
TPA_AUTHENTICATION_FAILURE,
|
TPA_AUTHENTICATION_FAILURE,
|
||||||
TPA_SESSION_EXPIRED,
|
TPA_SESSION_EXPIRED,
|
||||||
@@ -48,6 +49,9 @@ const RegistrationFailureMessage = (props) => {
|
|||||||
case TPA_SESSION_EXPIRED:
|
case TPA_SESSION_EXPIRED:
|
||||||
errorMessage = formatMessage(messages['registration.tpa.session.expired'], { provider: context.provider });
|
errorMessage = formatMessage(messages['registration.tpa.session.expired'], { provider: context.provider });
|
||||||
break;
|
break;
|
||||||
|
case FORBIDDEN_USERNAME:
|
||||||
|
errorMessage = formatMessage(messages['registration.forbidden.username']);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
errorMessage = formatMessage(messages['registration.empty.form.submission.error']);
|
errorMessage = formatMessage(messages['registration.empty.form.submission.error']);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ export const FORM_SUBMISSION_ERROR = 'form-submission-error';
|
|||||||
export const INTERNAL_SERVER_ERROR = 'internal-server-error';
|
export const INTERNAL_SERVER_ERROR = 'internal-server-error';
|
||||||
export const TPA_AUTHENTICATION_FAILURE = 'tpa-authentication-failure';
|
export const TPA_AUTHENTICATION_FAILURE = 'tpa-authentication-failure';
|
||||||
export const TPA_SESSION_EXPIRED = 'tpa-session-expired';
|
export const TPA_SESSION_EXPIRED = 'tpa-session-expired';
|
||||||
|
export const FORBIDDEN_USERNAME = 'forbidden-username';
|
||||||
|
|||||||
@@ -162,6 +162,11 @@ const messages = defineMessages({
|
|||||||
defaultMessage: 'Registration using {provider} has timed out.',
|
defaultMessage: 'Registration using {provider} has timed out.',
|
||||||
description: '',
|
description: '',
|
||||||
},
|
},
|
||||||
|
'registration.forbidden.username': {
|
||||||
|
id: 'registration.forbidden.username',
|
||||||
|
defaultMessage: 'Usernames can\'t include words that could be mistaken for course roles. Please choose a different username.',
|
||||||
|
description: '',
|
||||||
|
},
|
||||||
'registration.tpa.authentication.failure': {
|
'registration.tpa.authentication.failure': {
|
||||||
id: 'registration.tpa.authentication.failure',
|
id: 'registration.tpa.authentication.failure',
|
||||||
defaultMessage: 'We are sorry, you are not authorized to access {platform_name} via this channel. '
|
defaultMessage: 'We are sorry, you are not authorized to access {platform_name} via this channel. '
|
||||||
|
|||||||
Reference in New Issue
Block a user