mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
add hide phne number field on sign up
This commit is contained in:
parent
fc0f6d8e6b
commit
8bda3948d7
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import ModelForm, { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
|
import ModelForm, { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
|
||||||
import User from 'Model/Models/User';
|
import User from 'Model/Models/User';
|
||||||
import Link from 'CommonUI/src/Components/Link/Link';
|
import Link from 'CommonUI/src/Components/Link/Link';
|
||||||
@ -32,30 +32,32 @@ const RegisterPage: () => JSX.Element = () => {
|
|||||||
|
|
||||||
const [isLoading, setIsLoading] = React.useState<boolean>(false);
|
const [isLoading, setIsLoading] = React.useState<boolean>(false);
|
||||||
|
|
||||||
|
const [reseller, setResller] = React.useState<Reseller | undefined>(
|
||||||
const [reseller, setResller] = React.useState<Reseller | undefined>(undefined);
|
undefined
|
||||||
|
);
|
||||||
|
|
||||||
if (UserUtil.isLoggedIn()) {
|
if (UserUtil.isLoggedIn()) {
|
||||||
Navigation.navigate(DASHBOARD_URL);
|
Navigation.navigate(DASHBOARD_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchReseller = async (resellerId: string) => {
|
const fetchReseller: Function = async (resellerId: string): Promise<void> => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const reseller: ListResult<Reseller> = await ModelAPI.getList<Reseller>(
|
const reseller: ListResult<Reseller> =
|
||||||
Reseller,
|
await ModelAPI.getList<Reseller>(
|
||||||
{
|
Reseller,
|
||||||
resellerId: resellerId
|
{
|
||||||
},
|
resellerId: resellerId,
|
||||||
1,
|
},
|
||||||
0,
|
1,
|
||||||
{
|
0,
|
||||||
hidePhoneNumberOnSignup: true,
|
{
|
||||||
},
|
hidePhoneNumberOnSignup: true,
|
||||||
{},
|
},
|
||||||
{}
|
{},
|
||||||
);
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
if (reseller.data.length > 0) {
|
if (reseller.data.length > 0) {
|
||||||
setResller(reseller.data[0]);
|
setResller(reseller.data[0]);
|
||||||
@ -65,12 +67,8 @@ const RegisterPage: () => JSX.Element = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useAsyncEffect(async () => {
|
useAsyncEffect(async () => {
|
||||||
// if promo code is found, please save it in localstorage.
|
// if promo code is found, please save it in localstorage.
|
||||||
if (Navigation.getQueryStringByName('promoCode')) {
|
if (Navigation.getQueryStringByName('promoCode')) {
|
||||||
@ -80,7 +78,6 @@ const RegisterPage: () => JSX.Element = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Navigation.getQueryStringByName('email')) {
|
if (Navigation.getQueryStringByName('email')) {
|
||||||
setInitialValues({
|
setInitialValues({
|
||||||
email: Navigation.getQueryStringByName('email'),
|
email: Navigation.getQueryStringByName('email'),
|
||||||
@ -89,7 +86,7 @@ const RegisterPage: () => JSX.Element = () => {
|
|||||||
|
|
||||||
// if promo code is found, please save it in localstorage.
|
// if promo code is found, please save it in localstorage.
|
||||||
if (Navigation.getQueryStringByName('partnerId')) {
|
if (Navigation.getQueryStringByName('partnerId')) {
|
||||||
await fetchReseller(Navigation.getQueryStringByName('partnerId')!)
|
await fetchReseller(Navigation.getQueryStringByName('partnerId')!.toLowerCase());
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -125,7 +122,7 @@ const RegisterPage: () => JSX.Element = () => {
|
|||||||
placeholder: 'Acme, Inc.',
|
placeholder: 'Acme, Inc.',
|
||||||
required: true,
|
required: true,
|
||||||
title: 'Company Name',
|
title: 'Company Name',
|
||||||
}
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// If reseller wants to hide phone number on sign up, we hide it.
|
// If reseller wants to hide phone number on sign up, we hide it.
|
||||||
@ -173,11 +170,11 @@ const RegisterPage: () => JSX.Element = () => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return <ErrorMessage error={error} />
|
return <ErrorMessage error={error} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return <PageLoader isVisible={true} />
|
return <PageLoader isVisible={true} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -239,7 +239,6 @@ export default class Reseller extends BaseModel {
|
|||||||
})
|
})
|
||||||
public changePlanLink?: URL = undefined;
|
public changePlanLink?: URL = undefined;
|
||||||
|
|
||||||
|
|
||||||
@ColumnAccessControl({
|
@ColumnAccessControl({
|
||||||
create: [],
|
create: [],
|
||||||
read: [Permission.Public],
|
read: [Permission.Public],
|
||||||
@ -247,18 +246,14 @@ export default class Reseller extends BaseModel {
|
|||||||
})
|
})
|
||||||
@TableColumn({
|
@TableColumn({
|
||||||
required: false,
|
required: false,
|
||||||
type: TableColumnType.ShortURL,
|
type: TableColumnType.Boolean,
|
||||||
canReadOnRelationQuery: true,
|
canReadOnRelationQuery: true,
|
||||||
title: 'Change Plan Link',
|
title: 'Hide Phone Number on Signup',
|
||||||
description: 'Reseller Change plan Link',
|
description: 'Should we hide the phone number on sign up form based on reseller request?',
|
||||||
})
|
})
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
type: ColumnType.ShortURL,
|
type: ColumnType.Boolean
|
||||||
length: ColumnLength.ShortURL,
|
|
||||||
transformer: URL.getDatabaseTransformer(),
|
|
||||||
})
|
})
|
||||||
public hidePhoneNumberOnSignup?: boolean = undefined;
|
public hidePhoneNumberOnSignup?: boolean = undefined;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user