File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Resources/views/Admin/Content/Login Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -90,8 +90,12 @@ public function loginAction(Request $request): Response
9090 };
9191 }
9292
93+ $ lastUserName = $ this ->authenticationUtils ->getLastUsername ();
94+ $ request ->getSession ()->remove (SecurityRequestAttributes::LAST_USERNAME );
95+
9396 return $ this ->render ('@ShopsysFramework/Admin/Content/Login/loginForm.html.twig ' , [
9497 'form ' => $ form ->createView (),
98+ 'lastUsername ' => $ lastUserName ,
9599 'error ' => $ error ,
96100 ]);
97101 }
Original file line number Diff line number Diff line change 1919 <span class =" box-login__error" >
2020 {{ form_errors(form .username ) }}
2121 </span >
22- {{ form_widget(form .username , {attr : {placeholder : ' Username' |trans, class : ' box-login__input' }}) }}
22+ {% set
23+ usernameAttributes = {
24+ placeholder : ' Username' |trans,
25+ class : ' box-login__input' ,
26+ value : lastUsername
27+ }
28+ %}
29+ {% if not lastUsername %}
30+ {% set usernameAttributes = usernameAttributes | merge ({' autofocus' : ' autofocus' }) %}
31+ {% endif %}
32+ {{ form_widget(form .username , {attr : usernameAttributes }) }}
2333 </div >
2434
2535 <div class =" box-login__row" >
2636 <span class =" box-login__error" >
2737 {{ form_errors(form .password ) }}
2838 </span >
29- {{ form_widget(form .password , {attr : {placeholder : ' Password' |trans, class : ' box-login__input' }}) }}
39+ {% set
40+ passwordAttributes = {
41+ placeholder : ' Password' |trans,
42+ class : ' box-login__input' ,
43+ }
44+ %}
45+ {% if lastUsername %}
46+ {% set passwordAttributes = passwordAttributes | merge ({' autofocus' : ' autofocus' }) %}
47+ {% endif %}
48+ {{ form_widget(form .password , {attr : passwordAttributes }) }}
3049 </div >
3150
3251 <div class =" box-login__row box-login__row--btn" >
You can’t perform that action at this time.
0 commit comments