ldap-tfa: export * from pages/ldap
This commit is contained in:
parent
60519a171a
commit
e5b34e13d6
@ -1,14 +1 @@
|
||||
import { PageHead } from './ldap';
|
||||
import { Login } from '@/components';
|
||||
import { FormStateProvider } from '@/context/form-state';
|
||||
|
||||
export default function Page(props) {
|
||||
return (
|
||||
<FormStateProvider {...props}>
|
||||
<PageHead />
|
||||
<Login tfa />
|
||||
</FormStateProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export { getServerSideProps } from './ldap';
|
||||
export { default, getServerSideProps } from './ldap';
|
||||
|
||||
@ -21,27 +21,32 @@ export default function Page(props) {
|
||||
return (
|
||||
<FormStateProvider {...props}>
|
||||
<PageHead />
|
||||
<Login />
|
||||
<Login tfa={props.tfa} />
|
||||
</FormStateProvider>
|
||||
);
|
||||
}
|
||||
|
||||
/** @type {import('next').GetServerSideProps} */
|
||||
export async function getServerSideProps({ req }) {
|
||||
const headers = pick(req.headers, ['auth-mode', 'cookie', 'refresh-token']);
|
||||
const tfa = headers['auth-mode'] === 'ldap-tfa';
|
||||
|
||||
try {
|
||||
const headers = pick(req.headers, ['auth-mode', 'cookie', 'refresh-token']);
|
||||
const { data: user } = await axios.get(URL_API_CHECK_AUTH, {
|
||||
headers,
|
||||
});
|
||||
|
||||
return {
|
||||
props: {
|
||||
tfa,
|
||||
user,
|
||||
},
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
props: {},
|
||||
props: {
|
||||
tfa,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user