Fix recaptcha on login forms
This commit is contained in:
parent
f864b72e0a
commit
66410a35f1
10 changed files with 188 additions and 77 deletions
|
@ -7,8 +7,10 @@ import DashboardRouter from '@/routers/DashboardRouter';
|
|||
import ServerRouter from '@/routers/ServerRouter';
|
||||
import AuthenticationRouter from '@/routers/AuthenticationRouter';
|
||||
import { Provider } from 'react-redux';
|
||||
import { SiteSettings } from '@/state/settings';
|
||||
|
||||
interface WindowWithUser extends Window {
|
||||
interface ExtendedWindow extends Window {
|
||||
SiteConfiguration?: SiteSettings;
|
||||
PterodactylUser?: {
|
||||
uuid: string;
|
||||
username: string;
|
||||
|
@ -22,20 +24,24 @@ interface WindowWithUser extends Window {
|
|||
}
|
||||
|
||||
const App = () => {
|
||||
const data = (window as WindowWithUser).PterodactylUser;
|
||||
if (data && !store.getState().user.data) {
|
||||
const { PterodactylUser, SiteConfiguration } = (window as ExtendedWindow);
|
||||
if (PterodactylUser && !store.getState().user.data) {
|
||||
store.getActions().user.setUserData({
|
||||
uuid: data.uuid,
|
||||
username: data.username,
|
||||
email: data.email,
|
||||
language: data.language,
|
||||
rootAdmin: data.root_admin,
|
||||
useTotp: data.use_totp,
|
||||
createdAt: new Date(data.created_at),
|
||||
updatedAt: new Date(data.updated_at),
|
||||
uuid: PterodactylUser.uuid,
|
||||
username: PterodactylUser.username,
|
||||
email: PterodactylUser.email,
|
||||
language: PterodactylUser.language,
|
||||
rootAdmin: PterodactylUser.root_admin,
|
||||
useTotp: PterodactylUser.use_totp,
|
||||
createdAt: new Date(PterodactylUser.created_at),
|
||||
updatedAt: new Date(PterodactylUser.updated_at),
|
||||
});
|
||||
}
|
||||
|
||||
if (!store.getState().settings.data) {
|
||||
store.getActions().settings.setSettings(SiteConfiguration!);
|
||||
}
|
||||
|
||||
return (
|
||||
<StoreProvider store={store}>
|
||||
<Provider store={store}>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue