Remove Keycloak integration and related authentication logic. Update dashboard to exclude admin page and simplify user management. Introduce new components for chain selection, header, and login form. Refactor main page to handle user authentication and task selection more effectively. Update API routes for challenge-related endpoints.
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
Some checks failed
platform/bro-js/challenge-pl/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -5,9 +5,7 @@ import i18next from 'i18next'
|
||||
import { i18nextReactInitConfig } from '@brojs/cli'
|
||||
|
||||
import App from './app'
|
||||
import { keycloak } from "./__data__/kc"
|
||||
import { createStore } from "./__data__/store"
|
||||
import { isAuthLoopBlocked, recordAuthAttempt, clearAuthAttempts } from './utils/authLoopGuard'
|
||||
|
||||
i18next.t = i18next.t.bind(i18next)
|
||||
const i18nextPromise = i18nextReactInitConfig(i18next)
|
||||
@@ -17,41 +15,7 @@ export default (props) => <App {...props} />
|
||||
let rootElement: ReactDOM.Root
|
||||
|
||||
export const mount = async (Component, element = document.getElementById('app')) => {
|
||||
let user = null
|
||||
try {
|
||||
if (isAuthLoopBlocked()) {
|
||||
await i18nextPromise
|
||||
rootElement = ReactDOM.createRoot(element)
|
||||
rootElement.render(<button onClick={() => keycloak.login()} style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
backgroundColor: 'red',
|
||||
margin: 'auto'
|
||||
}}>Login</button>)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
recordAuthAttempt()
|
||||
await keycloak.init({
|
||||
onLoad: 'login-required'
|
||||
// onLoad: 'check-sso'
|
||||
})
|
||||
|
||||
const userInfo = await keycloak.loadUserInfo()
|
||||
|
||||
if (userInfo && keycloak.tokenParsed) {
|
||||
user = { ...userInfo, ...keycloak.tokenParsed }
|
||||
} else {
|
||||
console.error('No userInfo or tokenParsed', userInfo, keycloak.tokenParsed)
|
||||
}
|
||||
|
||||
clearAuthAttempts()
|
||||
} catch (error) {
|
||||
console.error('Failed to initialize adapter:', error)
|
||||
// keycloak.login()
|
||||
}
|
||||
const store = createStore({ user })
|
||||
const store = createStore()
|
||||
await i18nextPromise
|
||||
|
||||
rootElement = ReactDOM.createRoot(element)
|
||||
|
||||
Reference in New Issue
Block a user