5353use OCP \AppFramework \Http \DataResponse ;
5454use OCP \AppFramework \Http \RedirectResponse ;
5555use OCP \AppFramework \Http \TemplateResponse ;
56+ use OCP \AppFramework \Services \IInitialState ;
5657use OCP \Defaults ;
5758use OCP \IConfig ;
58- use OCP \IInitialStateService ;
5959use OCP \IL10N ;
6060use OCP \IRequest ;
6161use OCP \ISession ;
@@ -81,7 +81,7 @@ public function __construct(
8181 private IURLGenerator $ urlGenerator ,
8282 private Defaults $ defaults ,
8383 private IThrottler $ throttler ,
84- private IInitialStateService $ initialStateService ,
84+ private IInitialState $ initialState ,
8585 private WebAuthnManager $ webAuthnManager ,
8686 private IManager $ manager ,
8787 private IL10N $ l10n ,
@@ -148,32 +148,30 @@ public function showLoginForm(string $user = null, string $redirect_url = null):
148148 }
149149 if (is_array ($ loginMessages )) {
150150 [$ errors , $ messages ] = $ loginMessages ;
151- $ this ->initialStateService ->provideInitialState (' core ' , 'loginMessages ' , $ messages );
152- $ this ->initialStateService ->provideInitialState (' core ' , 'loginErrors ' , $ errors );
151+ $ this ->initialState ->provideInitialState ('loginMessages ' , $ messages );
152+ $ this ->initialState ->provideInitialState ('loginErrors ' , $ errors );
153153 }
154154 $ this ->session ->remove ('loginMessages ' );
155155
156156 if ($ user !== null && $ user !== '' ) {
157- $ this ->initialStateService ->provideInitialState (' core ' , 'loginUsername ' , $ user );
157+ $ this ->initialState ->provideInitialState ('loginUsername ' , $ user );
158158 } else {
159- $ this ->initialStateService ->provideInitialState (' core ' , 'loginUsername ' , '' );
159+ $ this ->initialState ->provideInitialState ('loginUsername ' , '' );
160160 }
161161
162- $ this ->initialStateService ->provideInitialState (
163- 'core ' ,
162+ $ this ->initialState ->provideInitialState (
164163 'loginAutocomplete ' ,
165164 $ this ->config ->getSystemValue ('login_form_autocomplete ' , true ) === true
166165 );
167166
168167 if (!empty ($ redirect_url )) {
169168 [$ url , ] = explode ('? ' , $ redirect_url );
170169 if ($ url !== $ this ->urlGenerator ->linkToRoute ('core.login.logout ' )) {
171- $ this ->initialStateService ->provideInitialState (' core ' , 'loginRedirectUrl ' , $ redirect_url );
170+ $ this ->initialState ->provideInitialState ('loginRedirectUrl ' , $ redirect_url );
172171 }
173172 }
174173
175- $ this ->initialStateService ->provideInitialState (
176- 'core ' ,
174+ $ this ->initialState ->provideInitialState (
177175 'loginThrottleDelay ' ,
178176 $ this ->throttler ->getDelay ($ this ->request ->getRemoteAddress ())
179177 );
@@ -182,9 +180,9 @@ public function showLoginForm(string $user = null, string $redirect_url = null):
182180
183181 $ this ->setEmailStates ();
184182
185- $ this ->initialStateService ->provideInitialState (' core ' , 'webauthn-available ' , $ this ->webAuthnManager ->isWebAuthnAvailable ());
183+ $ this ->initialState ->provideInitialState ('webauthn-available ' , $ this ->webAuthnManager ->isWebAuthnAvailable ());
186184
187- $ this ->initialStateService ->provideInitialState (' core ' , 'hideLoginForm ' , $ this ->config ->getSystemValueBool ('hide_login_form ' , false ));
185+ $ this ->initialState ->provideInitialState ('hideLoginForm ' , $ this ->config ->getSystemValueBool ('hide_login_form ' , false ));
188186
189187 // OpenGraph Support: http://ogp.me/
190188 Util::addHeader ('meta ' , ['property ' => 'og:title ' , 'content ' => Util::sanitizeHTML ($ this ->defaults ->getName ())]);
@@ -199,8 +197,9 @@ public function showLoginForm(string $user = null, string $redirect_url = null):
199197 'pageTitle ' => $ this ->l10n ->t ('Login ' ),
200198 ];
201199
202- $ this ->initialStateService ->provideInitialState ('core ' , 'countAlternativeLogins ' , count ($ parameters ['alt_login ' ]));
203- $ this ->initialStateService ->provideInitialState ('core ' , 'alternativeLogins ' , $ parameters ['alt_login ' ]);
200+ $ this ->initialState ->provideInitialState ('countAlternativeLogins ' , count ($ parameters ['alt_login ' ]));
201+ $ this ->initialState ->provideInitialState ('alternativeLogins ' , $ parameters ['alt_login ' ]);
202+ $ this ->initialState ->provideInitialState ('loginTimeout ' , $ this ->config ->getSystemValueInt ('login_form_timeout ' , 5 * 60 ));
204203
205204 return new TemplateResponse (
206205 $ this ->appName ,
@@ -224,14 +223,12 @@ private function setPasswordResetInitialState(?string $username): void {
224223
225224 $ passwordLink = $ this ->config ->getSystemValueString ('lost_password_link ' , '' );
226225
227- $ this ->initialStateService ->provideInitialState (
228- 'core ' ,
226+ $ this ->initialState ->provideInitialState (
229227 'loginResetPasswordLink ' ,
230228 $ passwordLink
231229 );
232230
233- $ this ->initialStateService ->provideInitialState (
234- 'core ' ,
231+ $ this ->initialState ->provideInitialState (
235232 'loginCanResetPassword ' ,
236233 $ this ->canResetPassword ($ passwordLink , $ user )
237234 );
@@ -255,11 +252,7 @@ private function setEmailStates(): void {
255252 array_push ($ emailStates , $ emailConfig ->__get ('ldapLoginFilterEmail ' ));
256253 }
257254 }
258- $ this ->initialStateService ->
259- provideInitialState (
260- 'core ' ,
261- 'emailStates ' ,
262- $ emailStates );
255+ $ this ->initialState ->provideInitialState ('emailStates ' , $ emailStates );
263256 }
264257
265258 /**
0 commit comments