Merge pull request #14 from ente-io/disable_signups

Disable signups
This commit is contained in:
Abhinav-grd 2021-02-14 12:14:35 +05:30 committed by GitHub
commit fcf5d4c3a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 82 additions and 64 deletions

View file

@ -13,7 +13,6 @@ export default function ErrorAlert({ errorCode }) {
default:
errorMessage = errorCode;
}
console.log(errorCode);
return (
<Alert variant={'danger'} style={{ display: errorCode ? 'block' : 'none' }}>
{errorMessage}

View file

@ -10,6 +10,7 @@ import * as Yup from 'yup';
import { getOtt } from 'services/userService';
import Container from 'components/Container';
import { setData, LS_KEYS, getData } from 'utils/storage/localStorage';
import { Alert } from 'react-bootstrap';
interface formValues {
email: string;
@ -18,6 +19,7 @@ interface formValues {
export default function Home() {
const [loading, setLoading] = useState(false);
const router = useRouter();
const [showMessage, setShowMessage] = useState(false);
useEffect(() => {
router.prefetch('/verify');
@ -38,16 +40,29 @@ export default function Home() {
setData(LS_KEYS.USER, { email });
router.push('/verify');
} catch (e) {
setFieldError('email', `${constants.UNKNOWN_ERROR} ${e.message}`);
if (e.response.status == 403) {
setFieldError('email', `${constants.USER_DOES_NOT_EXIST}`);
} else {
setFieldError(
'email',
`${constants.UNKNOWN_ERROR} ${e.message}`
);
}
}
setLoading(false);
};
const register = () => {
router.push('/signup');
setShowMessage(true);
setTimeout(() => setShowMessage(false), 15000);
};
return (
<>
<div style={{ display: showMessage ? 'block' : 'none' }}>
<Alert variant="info">{constants.WEB_SIGNUPS_DISABLED}</Alert>
</div>
<Container>
<Card style={{ minWidth: '300px' }} className="text-center">
<Card.Body>
@ -110,5 +125,6 @@ export default function Home() {
</Card.Body>
</Card>
</Container>
</>
);
}

View file

@ -61,6 +61,9 @@ const englishConstants = {
"You don't have a active subscription plan!! Please get one in the mobile app",
STORAGE_QUOTA_EXCEEDED:
'You have exceeded your designated storage Quota, please upgrade your plan to add more files',
WEB_SIGNUPS_DISABLED:
'Web signups are disabled for now, please install the mobile app and signup there',
USER_DOES_NOT_EXIST: 'Incorrect EmailId, No such user exists',
};
export default englishConstants;