@@ -12,7 +12,6 @@ import { KernLogo } from "@/pkg/ui/Icons"
1212import { DemoFlow } from "@/pkg/ui/DemoFlow"
1313import { getValueIdentifier , getValuePassword } from "@/util/helper-functions"
1414import ory from "@/pkg/sdk"
15- import { MiscInfo } from "@/services/basic-fetch/misc"
1615
1716const Login : NextPage = ( ) => {
1817 const [ initialFlow , setInitialFlow ] = useState < LoginFlow > ( ) ;
@@ -75,21 +74,6 @@ const Login: NextPage = () => {
7574
7675 const flowData : any = Object . assign ( { } , initialFlow ) ;
7776
78- let emailNode = flowData . ui . nodes . find ( ( node : any ) => node . meta ?. label ?. text == "E-Mail" ) ;
79- if ( emailNode && MiscInfo . isDemo ) {
80- emailNode . attributes . value = getValueIdentifier ( selectedRole ) ;
81- }
82-
83- let passwordNode = flowData . ui . nodes . find ( ( node : any ) => node . meta ?. label ?. text == "Password" ) ;
84- if ( passwordNode && MiscInfo . isDemo ) {
85- passwordNode . attributes . value = getValuePassword ( selectedRole ) ;
86- }
87-
88- let submitNode = flowData . ui . nodes . find ( ( node : any ) => node . meta ?. label ?. text == "Sign in" ) ;
89- if ( submitNode && MiscInfo . isDemo ) {
90- submitNode . meta . label . text = "Proceed"
91- }
92-
9377 if ( initialFlow . ui . nodes . some ( ( node : any ) => node . group === "totp" ) ) {
9478 const totcData = JSON . parse ( JSON . stringify ( flowData ) ) ;
9579 totcData . ui . nodes = totcData . ui . nodes . filter ( ( node : any ) => node . group == "totp" || node . group == "default" ) ;
@@ -120,11 +104,7 @@ const Login: NextPage = () => {
120104 window . location . href = initialFlow ?. return_to
121105 return
122106 }
123- if ( MiscInfo . isManaged ) {
124- router . push ( "/cognition" )
125- } else {
126- router . push ( "/refinery/projects" )
127- }
107+ router . push ( "/cognition" )
128108
129109 } )
130110 . then ( ( ) => { } )
@@ -149,60 +129,31 @@ const Login: NextPage = () => {
149129 < div className = "app-container" >
150130 < KernLogo />
151131 < div id = "login" >
152- < h2 className = "title" > { MiscInfo . isDemo ? 'Proceed with your selected role' : 'Sign in to your account' } </ h2 >
153- { ! MiscInfo . isDemo ? (
154- < > { MiscInfo . isManaged ? (
155- < p className = "text-paragraph" > Or
156- < a className = "link" data-testid = "cta-link" href = "/auth/registration" > Register account </ a > -
157- no credit card required!
158- </ p >
159- ) : ( < >
160- < p className = "text-paragraph" > You don't have an account yet?
161- < a className = "link" data-testid = "cta-link" href = "/auth/registration" > Sign up here (local)</ a >
162- </ p >
163- </ > ) } </ >
164- ) : ( < > </ > ) }
132+ < h2 className = "title" > Sign in to your account</ h2 >
133+ < p className = "text-paragraph" > Or
134+ < a className = "link" data-testid = "cta-link" href = "/auth/registration" > Register account </ a > -
135+ no credit card required!
136+ </ p >
165137 < div className = "ui-container" >
166- { ! MiscInfo . isDemo ? (
167- < div >
168- < Flow onSubmit = { onSubmit } flow = { changedFlow } only = "password" />
169- { oidcFlow ?
170- < >
171- < div className = "divider-outer" > < span className = "divider" > Or</ span > </ div >
172- < Flow onSubmit = { onSubmit } flow = { oidcFlow } only = "oidc" />
173- </ > : null }
174- { totpFlow ?
175- < >
176- < Flow onSubmit = { onSubmit } flow = { totpFlow } only = "totp" />
177- </ > : null }
178- </ div > ) : ( < >
179-
180- < fieldset >
181- < span className = "typography-h3" >
182- Select role
183- < span className = "required-indicator" > *</ span >
184- < select className = "typography-h3 select" id = "roles" value = { selectedRole } onChange = { ( e : any ) => { setSelectedRole ( e . target . value ) ; } } >
185- < option value = "engineer" > Engineer</ option >
186- < option value = "expert" > Expert</ option >
187- < option value = "annotator" > Annotator</ option >
188- </ select >
189- </ span >
190- </ fieldset >
191- < p className = "text-description" id = "description" >
192- { selectedRole === 'engineer' ? 'Administers the project and works on programmatic tasks such as labeling automation or filter settings.' : selectedRole === 'expert' ? 'Working on reference manual labels, which can be used by the engineering team to estimate the data quality.' : 'Working on manual labels as if they were heuristics. They can be switched on/off by the engineering team, so that the engineers can in - or exclude them during weak supervision.' }
193- </ p >
194- < p className = "text-description" id = "sub-description" >
195- { selectedRole === 'engineer' ? 'They have access to all features of the application, including the Python SDK.' : selectedRole === 'expert' ? 'They have access to the labeling view only.' : 'They have access to a task-minimized labeling view only. Engineers can revoke their access to the labeling view.' }
196- </ p >
197- < DemoFlow onSubmit = { onSubmit } flow = { changedFlow } />
198- </ > ) }
138+ < div >
139+ < Flow onSubmit = { onSubmit } flow = { changedFlow } only = "password" />
140+ { oidcFlow ?
141+ < >
142+ < div className = "divider-outer" > < span className = "divider" > Or</ span > </ div >
143+ < Flow onSubmit = { onSubmit } flow = { oidcFlow } only = "oidc" />
144+ </ > : null }
145+ { totpFlow ?
146+ < >
147+ < Flow onSubmit = { onSubmit } flow = { totpFlow } only = "totp" />
148+ </ > : null }
149+ </ div >
199150 </ div >
200151 < div className = "link-container" >
201- { ! MiscInfo . isDemo ?
152+ {
202153 ! isAccLinkageRequested ?
203154 < a className = "link" data-testid = "forgot-password" href = "/auth/recovery" > Forgot your password?</ a >
204155 : < a className = "link" data-testid = "back-to-login" href = "/auth/login" > Go back to login</ a >
205- : null }
156+ }
206157 </ div >
207158 </ div >
208159 </ div >
0 commit comments