From 977759145e039290c0a90f956781cbc7e870f2e1 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Tue, 19 Oct 2021 19:38:09 +0530 Subject: [PATCH] Fix redirect on SSO login (#142), #27, #94 Signed-off-by: Ajay Bura --- src/app/pages/App.jsx | 14 ++------------ src/app/templates/auth/Auth.jsx | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/app/pages/App.jsx b/src/app/pages/App.jsx index bb26505..ad73e98 100644 --- a/src/app/pages/App.jsx +++ b/src/app/pages/App.jsx @@ -1,6 +1,6 @@ import React from 'react'; import { - BrowserRouter, Switch, Route, Redirect, + BrowserRouter, } from 'react-router-dom'; import { isAuthenticated } from '../../client/state/auth'; @@ -11,17 +11,7 @@ import Client from '../templates/client/Client'; function App() { return ( - - - { isAuthenticated() ? : } - - - { isAuthenticated() ? : } - - - { isAuthenticated() ? : } - - + { isAuthenticated() ? : } ); } diff --git a/src/app/templates/auth/Auth.jsx b/src/app/templates/auth/Auth.jsx index 3eaf16a..f2d2b1e 100644 --- a/src/app/templates/auth/Auth.jsx +++ b/src/app/templates/auth/Auth.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import './Auth.scss'; import ReCAPTCHA from 'react-google-recaptcha'; -import { Link, useLocation } from 'react-router-dom'; +import { useLocation } from 'react-router-dom'; import * as auth from '../../../client/action/auth'; import cons from '../../../client/state/cons'; @@ -75,7 +75,8 @@ function normalizeUsername(rawUsername) { return noLeadingAt.trim(); } -function Auth({ type }) { +function Auth() { + const [type, setType] = useState('login'); const [process, changeProcess] = useState(null); const [homeserver, changeHomeserver] = useState('matrix.org'); @@ -316,9 +317,16 @@ function Auth({ type }) {
{`${(type === 'login' ? 'Don\'t have' : 'Already have')} an account?`} - +
@@ -326,10 +334,6 @@ function Auth({ type }) { ); } -Auth.propTypes = { - type: PropTypes.string.isRequired, -}; - function StaticWrapper({ children }) { return (