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