зеркало из https://github.com/mozilla/fxa.git
Merge pull request #15708 from mozilla/react-validation-fix
fix(react): class-validator decorator tweaks around query params
This commit is contained in:
Коммит
8f42446150
|
@ -3,10 +3,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import {
|
||||
IsBoolean,
|
||||
IsHexadecimal,
|
||||
IsOptional,
|
||||
IsString,
|
||||
IsBoolean,
|
||||
} from 'class-validator';
|
||||
import {
|
||||
bind,
|
||||
|
|
|
@ -16,12 +16,12 @@ import { IntegrationFlags } from '../../lib/integrations';
|
|||
import { BaseIntegrationData } from './web-integration';
|
||||
import {
|
||||
IsBoolean,
|
||||
IsBooleanString,
|
||||
IsEmail,
|
||||
IsHexadecimal,
|
||||
IsIn,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsPositive,
|
||||
IsString,
|
||||
MaxLength,
|
||||
MinLength,
|
||||
|
@ -109,10 +109,11 @@ export class OAuthIntegrationData extends BaseIntegrationData {
|
|||
@bind(T.snakeCase)
|
||||
idTokenHint: string | undefined;
|
||||
|
||||
@IsPositive()
|
||||
// TODO: Validation - this should be converted to a number and then checked if it's >= 0
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@bind(T.snakeCase)
|
||||
maxAge: number | undefined;
|
||||
maxAge: string | undefined;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
@ -143,10 +144,10 @@ export class OAuthIntegrationData extends BaseIntegrationData {
|
|||
@bind(T.snakeCase)
|
||||
redirectUri: string | undefined;
|
||||
|
||||
@IsBoolean()
|
||||
@IsBooleanString()
|
||||
@IsOptional()
|
||||
@bind(T.snakeCase)
|
||||
returnOnError: boolean | undefined;
|
||||
returnOnError: 'true' | 'false' | undefined;
|
||||
|
||||
// TODO - Validation - Should scope be required?
|
||||
@IsOptional()
|
||||
|
|
|
@ -4,14 +4,12 @@
|
|||
|
||||
import {
|
||||
IsBase64,
|
||||
IsBoolean,
|
||||
IsBooleanString,
|
||||
IsEmail,
|
||||
IsHexadecimal,
|
||||
IsIn,
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsPositive,
|
||||
IsString,
|
||||
} from 'class-validator';
|
||||
import {
|
||||
|
@ -71,11 +69,11 @@ export class SignInSignUpInfo extends ModelDataProvider {
|
|||
@bind(T.snakeCase)
|
||||
loginHint: string | undefined;
|
||||
|
||||
// TODO: Validation - this should be converted to a number and then checked if it's >= 0
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@IsPositive()
|
||||
@IsString()
|
||||
@bind(T.snakeCase)
|
||||
maxAge: number | undefined;
|
||||
maxAge: string | undefined;
|
||||
|
||||
@IsOptional()
|
||||
@IsIn(['consent', 'none', 'login'])
|
||||
|
@ -95,9 +93,9 @@ export class SignInSignUpInfo extends ModelDataProvider {
|
|||
redirectTo: string | undefined;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@IsBooleanString()
|
||||
@bind(T.snakeCase)
|
||||
returnOnError: boolean | undefined;
|
||||
returnOnError: 'true' | 'false' | undefined;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
|
|
|
@ -26,7 +26,10 @@ export class BaseIntegrationData extends ModelDataProvider {
|
|||
context: string | undefined;
|
||||
|
||||
@IsOptional()
|
||||
@IsEmail()
|
||||
// TODO - Validation - change this to 'IsEmail'. Requiring this to be an email
|
||||
// causes this to throw when we have a separate model, like a query param or
|
||||
// link model for a page, where we validate this instead.
|
||||
@IsString()
|
||||
@bind()
|
||||
email: string | undefined;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче