Webatrice: fix login bugs (#4557)

* fix login after failed connection attempts, limit connection attempt time

* fix register hashed password and salt

* add feature detection and Unsupported Browser screen

* nit

Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
This commit is contained in:
Jeremy Letto 2022-02-04 13:07:15 -06:00 committed by GitHub
parent 81d031ca0f
commit bb16ae09ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 104 additions and 18 deletions

View file

@ -6,6 +6,7 @@ import CssBaseline from '@material-ui/core/CssBaseline';
import { store } from 'store';
import { Header } from 'components';
import Routes from './AppShellRoutes';
import FeatureDetection from './FeatureDetection';
import './AppShell.css';
@ -26,6 +27,8 @@ class AppShell extends Component {
<div className="AppShell" onContextMenu={this.handleContextMenu}>
<Router>
<Header />
<FeatureDetection />
<Routes />
</Router>
</div>

View file

@ -10,7 +10,8 @@ import {
Room,
Server,
Login,
Logs
Logs,
Unsupported
} from 'containers';
const Routes = () => (
@ -24,6 +25,7 @@ const Routes = () => (
{<Route path={RouteEnum.ROOM} render={() => <Room />} />}
<Route path={RouteEnum.SERVER} render={() => <Server />} />
<Route path={RouteEnum.LOGIN} render={() => <Login />} />
<Route path={RouteEnum.UNSUPPORTED} render={() => <Unsupported />} />
<Redirect from="*" to={RouteEnum.LOGIN} />
</Switch>

View file

@ -0,0 +1,26 @@
import { useEffect, useState } from 'react';
import { Redirect } from 'react-router-dom';
import { dexieService } from 'services';
import { RouteEnum } from 'types';
const FeatureDetection = () => {
const [unsupported, setUnsupported] = useState(false);
useEffect(() => {
const features: Promise<any>[] = [
detectIndexedDB(),
];
Promise.all(features).catch((e) => setUnsupported(true));
}, []);
return unsupported
? <Redirect from="*" to={RouteEnum.UNSUPPORTED} />
: <></>;
function detectIndexedDB() {
return dexieService.testConnection();
}
};
export default FeatureDetection;