99namespace EzSystems \EzPlatformUser \Form \Factory ;
1010
1111use eZ \Publish \API \Repository \Values \ContentType \ContentType ;
12- use EzSystems \ EzPlatformUser \ Form \ Data \ UserPasswordForgotData ;
12+ use eZ \ Publish \ API \ Repository \ Values \ User \ User ;
1313use EzSystems \EzPlatformUser \Form \Data \UserPasswordChangeData ;
14+ use EzSystems \EzPlatformUser \Form \Data \UserPasswordForgotData ;
15+ use EzSystems \EzPlatformUser \Form \Data \UserPasswordForgotWithLoginData ;
16+ use EzSystems \EzPlatformUser \Form \Data \UserPasswordResetData ;
1417use EzSystems \EzPlatformUser \Form \Data \UserSettingUpdateData ;
1518use EzSystems \EzPlatformUser \Form \Type \UserPasswordChangeType ;
1619use EzSystems \EzPlatformUser \Form \Type \UserPasswordForgotType ;
17- use EzSystems \EzPlatformUser \Form \Data \UserPasswordForgotWithLoginData ;
1820use EzSystems \EzPlatformUser \Form \Type \UserPasswordForgotWithLoginType ;
19- use EzSystems \EzPlatformUser \Form \Data \UserPasswordResetData ;
2021use EzSystems \EzPlatformUser \Form \Type \UserPasswordResetType ;
2122use EzSystems \EzPlatformUser \Form \Type \UserSettingUpdateType ;
2223use Symfony \Component \Form \FormFactoryInterface ;
23- use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
2424use Symfony \Component \Form \FormInterface ;
2525use Symfony \Component \Form \Util \StringUtil ;
26+ use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
2627
2728class FormFactory
2829{
@@ -45,15 +46,19 @@ public function __construct(FormFactoryInterface $formFactory, UrlGeneratorInter
4546 public function changeUserPassword (
4647 ContentType $ contentType ,
4748 UserPasswordChangeData $ data = null ,
48- ?string $ name = null
49+ ?string $ name = null ,
50+ ?User $ user = null
4951 ): FormInterface {
5052 $ name = $ name ?: StringUtil::fqcnToBlockPrefix (UserPasswordChangeType::class);
5153
5254 return $ this ->formFactory ->createNamed (
5355 $ name ,
5456 UserPasswordChangeType::class,
5557 $ data ,
56- ['content_type ' => $ contentType ]
58+ [
59+ 'content_type ' => $ contentType ,
60+ 'user ' => $ user ,
61+ ]
5762 );
5863 }
5964
@@ -102,13 +107,22 @@ public function forgotUserPasswordWithLogin(
102107 public function resetUserPassword (
103108 UserPasswordResetData $ data = null ,
104109 ?string $ name = null ,
105- ContentType $ contentType = null
110+ ?ContentType $ contentType = null ,
111+ ?User $ user = null
106112 ): FormInterface {
107113 $ name = $ name ?: StringUtil::fqcnToBlockPrefix (UserPasswordResetType::class);
108114
109115 $ userContentType = $ contentType ?? $ data ->getContentType ();
110116
111- return $ this ->formFactory ->createNamed ($ name , UserPasswordResetType::class, $ data , ['content_type ' => $ userContentType ]);
117+ return $ this ->formFactory ->createNamed (
118+ $ name ,
119+ UserPasswordResetType::class,
120+ $ data ,
121+ [
122+ 'content_type ' => $ userContentType ,
123+ 'user ' => $ user ,
124+ ]
125+ );
112126 }
113127
114128 /**
0 commit comments