File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
packages/web-core/src/services Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,13 @@ export class ConnectService {
124124
125125 async loginInit ( abortController : AbortController ) : Promise < Result < ConnectLoginInitData , CorbadoError > > {
126126 const existingProcess = ConnectProcess . loadFromStorage ( this . #projectId) ;
127- if ( existingProcess ) {
127+ if (
128+ existingProcess ?. loginData &&
129+ ! existingProcess ?. loginData . loginAllowed &&
130+ ConnectInvitation . loadFromStorage ( ) ?. token
131+ ) {
132+ existingProcess . resetLoginData ( ) . persistToStorage ( ) ;
133+ } else if ( existingProcess ) {
128134 log . debug ( 'process exists, preparing api clients' ) ;
129135 this . #setApisV2( existingProcess ) ;
130136
@@ -144,14 +150,11 @@ export class ConnectService {
144150 }
145151
146152 const existingProcessFromOtherLoginInit = ConnectProcess . loadFromStorage ( this . #projectId) ;
147- if ( existingProcessFromOtherLoginInit ) {
153+ if ( existingProcessFromOtherLoginInit ?. loginData ) {
148154 log . debug ( 'process exists (after login init attempt' ) ;
149155 this . #setApisV2( existingProcessFromOtherLoginInit ) ;
150156
151- // process has already been initialized
152- if ( existingProcessFromOtherLoginInit ?. loginData ) {
153- return Ok ( existingProcessFromOtherLoginInit . loginData ) ;
154- }
157+ return Ok ( existingProcessFromOtherLoginInit . loginData ) ;
155158 }
156159
157160 // if the backend decides that a new client handle is needed, we store it in local storage
You can’t perform that action at this time.
0 commit comments