1 export const tokenIsValid = (token: string) => {
2 const expectedLength = 10;
3 const validPattern = /^[a-zA-Z0-9]+$/;
4 if (token.length !== expectedLength || !validPattern.test(token)) {
10 export const getTokenFromSearchParams = () => {
11 // TODO: Add case when token is undefined remove it from url
12 const urlSearchParams = new URLSearchParams(window.location.search);
13 const token = urlSearchParams.get('token');
14 if (!token || !tokenIsValid(token)) {