From 117928a25606b5d22cac915f7bfce5fd43b20202 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 27 Aug 2020 19:39:51 +0000 Subject: [PATCH] Don't show login form if using registration bypass --- webclient/src/Home.js | 18 +++++++++++++++--- webclient/src/LoginSignup.js | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/webclient/src/Home.js b/webclient/src/Home.js index 876212c..c6c41fd 100644 --- a/webclient/src/Home.js +++ b/webclient/src/Home.js @@ -1,5 +1,5 @@ import React, { useState, useEffect, useReducer } from 'react'; -import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; +import { BrowserRouter as Router, Switch, Route, Link, useParams, useLocation } from 'react-router-dom'; import moment from 'moment-timezone'; import './light.css'; import { Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Popup, Segment, Table } from 'semantic-ui-react'; @@ -131,6 +131,9 @@ export function Home(props) { const { user } = props; const [stats, setStats] = useState(JSON.parse(localStorage.getItem('stats', 'false'))); const [refreshCount, refreshStats] = useReducer(x => x + 1, 0); + const location = useLocation(); + + const bypass_code = location.hash.replace('#', ''); useEffect(() => { requester('/stats/', 'GET') @@ -172,9 +175,18 @@ export function Home(props) { :
- + {bypass_code ? + + Outside Registration +

This page allows you to sign up from outside of Protospace.

+
+ : + <> + - Or + Or + + }
diff --git a/webclient/src/LoginSignup.js b/webclient/src/LoginSignup.js index 36e2c70..ec8634d 100644 --- a/webclient/src/LoginSignup.js +++ b/webclient/src/LoginSignup.js @@ -110,7 +110,7 @@ export function SignupForm(props) { return (
-
Sign Up from Protospace
+
Sign Up to Spaceport