@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @see client/html/account/profile/url/config |
87 | 87 | */ |
88 | 88 | |
89 | -$passwordErrors = $this->get('passwordErrors', []); |
|
89 | +$passwordErrors = $this->get( 'passwordErrors', [] ); |
|
90 | 90 | |
91 | 91 | ?> |
92 | 92 | <?php $this->block()->start( 'account/profile/account' ) ?> |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | <h1 class="header"><?= $enc->html( $this->translate( 'client', 'account' ) ) ?></h1> |
96 | 96 | <form class="container-fluid" method="POST" action="<?= $enc->attr( $this->link( 'client/html/account/profile/url' ) ) ?>"> |
97 | 97 | <?= $this->csrf()->formfield() ?> |
98 | - <?php if ( $this->get('passwordChanged', '') === 'true' ) : ?> |
|
98 | + <?php if( $this->get( 'passwordChanged', '' ) === 'true' ) : ?> |
|
99 | 99 | <div class="row d-flex justify-content-center"> |
100 | 100 | <h2 class="text-success">Password changed successfull!</h2> |
101 | 101 | </div> |
102 | - <?php elseif ($this->get('passwordChanged', '') === 'false') :?> |
|
102 | + <?php elseif( $this->get( 'passwordChanged', '' ) === 'false' ) :?> |
|
103 | 103 | <div class="row d-flex justify-content-center"> |
104 | 104 | <h2 class="text-danger">Error(s) occured!</h2> |
105 | 105 | </div> |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | name="<?= $enc->attr( $this->formparam( array( 'account', 'customer.oldpassword' ) ) ) ?>" |
120 | 120 | placeholder="<?= $enc->attr( $this->translate( 'client', 'Old password' ) ) ?>" |
121 | 121 | > |
122 | - <?php if( isset($passwordErrors['oldPassword']) ) : ?> |
|
122 | + <?php if( isset( $passwordErrors['oldPassword'] ) ) : ?> |
|
123 | 123 | <span class="invalid-feedback d-block" role="alert"> |
124 | 124 | <strong><?= $passwordErrors['oldPassword'] ?></strong> |
125 | 125 | </span> |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | name="<?= $enc->attr( $this->formparam( array( 'account', 'customer.newpassword' ) ) ) ?>" |
139 | 139 | placeholder="<?= $enc->attr( $this->translate( 'client', 'New password' ) ) ?>" |
140 | 140 | > |
141 | - <?php if( isset($passwordErrors['confirm']) ) : ?> |
|
141 | + <?php if( isset( $passwordErrors['confirm'] ) ) : ?> |
|
142 | 142 | <span class="invalid-feedback d-block" role="alert"> |
143 | 143 | <strong><?= $passwordErrors['confirm'] ?></strong> |
144 | 144 | </span> |
145 | 145 | <?php endif ?> |
146 | - <?php if( isset($passwordErrors['isNew']) ) : ?> |
|
146 | + <?php if( isset( $passwordErrors['isNew'] ) ) : ?> |
|
147 | 147 | <span class="invalid-feedback d-block" role="alert"> |
148 | 148 | <strong><?= $passwordErrors['isNew'] ?></strong> |
149 | 149 | </span> |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | name="<?= $enc->attr( $this->formparam( array( 'account', 'customer.confirmnewpassword' ) ) ) ?>" |
163 | 163 | placeholder="<?= $enc->attr( $this->translate( 'client', 'Confirm password' ) ) ?>" |
164 | 164 | > |
165 | - <?php if( isset($passwordErrors['confirm']) ) : ?> |
|
165 | + <?php if( isset( $passwordErrors['confirm'] ) ) : ?> |
|
166 | 166 | <span class="invalid-feedback d-block" role="alert"> |
167 | 167 | <strong><?= $passwordErrors['confirm'] ?></strong> |
168 | 168 | </span> |
169 | 169 | <?php endif ?> |
170 | - <?php if( isset($passwordErrors['isNew']) ) : ?> |
|
170 | + <?php if( isset( $passwordErrors['isNew'] ) ) : ?> |
|
171 | 171 | <span class="invalid-feedback d-block" role="alert"> |
172 | 172 | <strong><?= $passwordErrors['isNew'] ?></strong> |
173 | 173 | </span> |
@@ -11,144 +11,144 @@ |
||
11 | 11 | * @subpackage Html |
12 | 12 | */ |
13 | 13 | class Standard |
14 | - extends \Aimeos\Client\Html\Common\Client\Summary\Base |
|
15 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
14 | + extends \Aimeos\Client\Html\Common\Client\Summary\Base |
|
15 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
16 | 16 | { |
17 | 17 | |
18 | - /** client/html/account/profile/address/subparts |
|
19 | - * List of HTML sub-clients rendered within the account profile address section |
|
20 | - * |
|
21 | - * The output of the frontend is composed of the code generated by the HTML |
|
22 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
23 | - * that are responsible for rendering certain sub-parts of the output. The |
|
24 | - * sub-clients can contain HTML clients themselves and therefore a |
|
25 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
26 | - * the output that is placed inside the container of its parent. |
|
27 | - * |
|
28 | - * At first, always the HTML code generated by the parent is printed, then |
|
29 | - * the HTML code of its sub-clients. The address of the HTML sub-clients |
|
30 | - * determines the address of the output of these sub-clients inside the parent |
|
31 | - * container. If the configured list of clients is |
|
32 | - * |
|
33 | - * array( "subclient1", "subclient2" ) |
|
34 | - * |
|
35 | - * you can easily change the address of the output by readdressing the subparts: |
|
36 | - * |
|
37 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
38 | - * |
|
39 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
40 | - * |
|
41 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
42 | - * |
|
43 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
44 | - * should support adding, removing or readdressing content by a fluid like |
|
45 | - * design. |
|
46 | - * |
|
47 | - * @param array List of sub-client names |
|
48 | - * @since 2019.07 |
|
49 | - * @category Developer |
|
50 | - */ |
|
51 | - private $subPartPath = 'client/html/account/profile/account/subparts'; |
|
52 | - private $subPartNames = []; |
|
53 | - |
|
54 | - protected function getSubClientNames(): array |
|
55 | - { |
|
56 | - return []; |
|
57 | - } |
|
58 | - |
|
59 | - public function getSubClient(string $type, string $name = null): \Aimeos\Client\Html\Iface |
|
60 | - { |
|
61 | - // TODO: Implement getSubClient() method. |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * Returns the HTML code for insertion into the body. |
|
66 | - * |
|
67 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
68 | - * @return string HTML code |
|
69 | - */ |
|
70 | - public function getBody(string $uid = ''): string |
|
71 | - { |
|
72 | - $view = $this->getView(); |
|
73 | - |
|
74 | - $html = ''; |
|
75 | - foreach( $this->getSubClients() as $subclient ) { |
|
76 | - $html .= $subclient->setView( $view )->getBody( $uid ); |
|
77 | - } |
|
78 | - $view->addressBody = $html; |
|
79 | - |
|
80 | - /** client/html/account/profile/address/template-body |
|
81 | - * Relative path to the HTML body template of the account profile address client. |
|
82 | - * |
|
83 | - * The template file contains the HTML code and processing instructions |
|
84 | - * to generate the result shown in the body of the frontend. The |
|
85 | - * configuration string is the path to the template file relative |
|
86 | - * to the templates directory (usually in client/html/templates). |
|
87 | - * |
|
88 | - * You can overwrite the template file configuration in extensions and |
|
89 | - * provide alternative templates. These alternative templates should be |
|
90 | - * named like the default one but with the string "standard" replaced by |
|
91 | - * an unique name. You may use the name of your project for this. If |
|
92 | - * you've implemented an alternative client class as well, "standard" |
|
93 | - * should be replaced by the name of the new class. |
|
94 | - * |
|
95 | - * @param string Relative path to the template creating code for the HTML page body |
|
96 | - * @since 2019.07 |
|
97 | - * @category Developer |
|
98 | - * @see client/html/account/profile/address/template-header |
|
99 | - */ |
|
100 | - $tplconf = 'client/html/account/profile/account/template-body'; |
|
101 | - $default = 'account/profile/account-body-standard'; |
|
102 | - |
|
103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Processes the input, e.g. store given values. |
|
108 | - * |
|
109 | - * A view must be available and this method doesn't generate any output |
|
110 | - * besides setting view variables if necessary. |
|
111 | - */ |
|
112 | - public function process() |
|
113 | - { |
|
114 | - $view = $this->getView(); |
|
115 | - |
|
116 | - if( !$view->param( 'account/save' ) ) { |
|
117 | - return parent::process(); |
|
118 | - } |
|
119 | - |
|
120 | - /** @var \Aimeos\Controller\Frontend\Customer\Standard $cntl */ |
|
121 | - $cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' ); |
|
122 | - $oldPassword = $cntl->get()->getPassword(); |
|
123 | - $values = $view->param('account', []); |
|
124 | - |
|
125 | - $isNew = $values['customer.newpassword'] !== $values['customer.oldpassword']; |
|
126 | - $confirmed = $values['customer.newpassword'] === $values['customer.confirmnewpassword']; |
|
127 | - |
|
128 | - $errors = []; |
|
129 | - |
|
130 | - if (!$isNew) { |
|
131 | - $errors['isNew'] = "The given password is not new!"; |
|
132 | - } |
|
133 | - |
|
134 | - if (!$confirmed) { |
|
135 | - $errors["confirm"] = "New passwords doesnt match!"; |
|
136 | - } |
|
137 | - |
|
138 | - $cntl = $cntl->add($values); |
|
139 | - |
|
140 | - if ( $oldPassword === $cntl->get()->getPassword() ) { |
|
141 | - $errors['oldPassword'] = "Wrong password!"; |
|
142 | - } |
|
143 | - |
|
144 | - $view->passwordChanged = count(array_keys($errors)) === 0; |
|
145 | - |
|
146 | - if (count(array_keys($errors)) > 0) { |
|
147 | - $view->passwordErrors = $errors; |
|
148 | - } |
|
149 | - |
|
150 | - $cntl->store(); |
|
151 | - |
|
152 | - parent::process(); |
|
153 | - } |
|
18 | + /** client/html/account/profile/address/subparts |
|
19 | + * List of HTML sub-clients rendered within the account profile address section |
|
20 | + * |
|
21 | + * The output of the frontend is composed of the code generated by the HTML |
|
22 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
23 | + * that are responsible for rendering certain sub-parts of the output. The |
|
24 | + * sub-clients can contain HTML clients themselves and therefore a |
|
25 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
26 | + * the output that is placed inside the container of its parent. |
|
27 | + * |
|
28 | + * At first, always the HTML code generated by the parent is printed, then |
|
29 | + * the HTML code of its sub-clients. The address of the HTML sub-clients |
|
30 | + * determines the address of the output of these sub-clients inside the parent |
|
31 | + * container. If the configured list of clients is |
|
32 | + * |
|
33 | + * array( "subclient1", "subclient2" ) |
|
34 | + * |
|
35 | + * you can easily change the address of the output by readdressing the subparts: |
|
36 | + * |
|
37 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
38 | + * |
|
39 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
40 | + * |
|
41 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
42 | + * |
|
43 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
44 | + * should support adding, removing or readdressing content by a fluid like |
|
45 | + * design. |
|
46 | + * |
|
47 | + * @param array List of sub-client names |
|
48 | + * @since 2019.07 |
|
49 | + * @category Developer |
|
50 | + */ |
|
51 | + private $subPartPath = 'client/html/account/profile/account/subparts'; |
|
52 | + private $subPartNames = []; |
|
53 | + |
|
54 | + protected function getSubClientNames(): array |
|
55 | + { |
|
56 | + return []; |
|
57 | + } |
|
58 | + |
|
59 | + public function getSubClient(string $type, string $name = null): \Aimeos\Client\Html\Iface |
|
60 | + { |
|
61 | + // TODO: Implement getSubClient() method. |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * Returns the HTML code for insertion into the body. |
|
66 | + * |
|
67 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
68 | + * @return string HTML code |
|
69 | + */ |
|
70 | + public function getBody(string $uid = ''): string |
|
71 | + { |
|
72 | + $view = $this->getView(); |
|
73 | + |
|
74 | + $html = ''; |
|
75 | + foreach( $this->getSubClients() as $subclient ) { |
|
76 | + $html .= $subclient->setView( $view )->getBody( $uid ); |
|
77 | + } |
|
78 | + $view->addressBody = $html; |
|
79 | + |
|
80 | + /** client/html/account/profile/address/template-body |
|
81 | + * Relative path to the HTML body template of the account profile address client. |
|
82 | + * |
|
83 | + * The template file contains the HTML code and processing instructions |
|
84 | + * to generate the result shown in the body of the frontend. The |
|
85 | + * configuration string is the path to the template file relative |
|
86 | + * to the templates directory (usually in client/html/templates). |
|
87 | + * |
|
88 | + * You can overwrite the template file configuration in extensions and |
|
89 | + * provide alternative templates. These alternative templates should be |
|
90 | + * named like the default one but with the string "standard" replaced by |
|
91 | + * an unique name. You may use the name of your project for this. If |
|
92 | + * you've implemented an alternative client class as well, "standard" |
|
93 | + * should be replaced by the name of the new class. |
|
94 | + * |
|
95 | + * @param string Relative path to the template creating code for the HTML page body |
|
96 | + * @since 2019.07 |
|
97 | + * @category Developer |
|
98 | + * @see client/html/account/profile/address/template-header |
|
99 | + */ |
|
100 | + $tplconf = 'client/html/account/profile/account/template-body'; |
|
101 | + $default = 'account/profile/account-body-standard'; |
|
102 | + |
|
103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Processes the input, e.g. store given values. |
|
108 | + * |
|
109 | + * A view must be available and this method doesn't generate any output |
|
110 | + * besides setting view variables if necessary. |
|
111 | + */ |
|
112 | + public function process() |
|
113 | + { |
|
114 | + $view = $this->getView(); |
|
115 | + |
|
116 | + if( !$view->param( 'account/save' ) ) { |
|
117 | + return parent::process(); |
|
118 | + } |
|
119 | + |
|
120 | + /** @var \Aimeos\Controller\Frontend\Customer\Standard $cntl */ |
|
121 | + $cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' ); |
|
122 | + $oldPassword = $cntl->get()->getPassword(); |
|
123 | + $values = $view->param('account', []); |
|
124 | + |
|
125 | + $isNew = $values['customer.newpassword'] !== $values['customer.oldpassword']; |
|
126 | + $confirmed = $values['customer.newpassword'] === $values['customer.confirmnewpassword']; |
|
127 | + |
|
128 | + $errors = []; |
|
129 | + |
|
130 | + if (!$isNew) { |
|
131 | + $errors['isNew'] = "The given password is not new!"; |
|
132 | + } |
|
133 | + |
|
134 | + if (!$confirmed) { |
|
135 | + $errors["confirm"] = "New passwords doesnt match!"; |
|
136 | + } |
|
137 | + |
|
138 | + $cntl = $cntl->add($values); |
|
139 | + |
|
140 | + if ( $oldPassword === $cntl->get()->getPassword() ) { |
|
141 | + $errors['oldPassword'] = "Wrong password!"; |
|
142 | + } |
|
143 | + |
|
144 | + $view->passwordChanged = count(array_keys($errors)) === 0; |
|
145 | + |
|
146 | + if (count(array_keys($errors)) > 0) { |
|
147 | + $view->passwordErrors = $errors; |
|
148 | + } |
|
149 | + |
|
150 | + $cntl->store(); |
|
151 | + |
|
152 | + parent::process(); |
|
153 | + } |
|
154 | 154 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | return []; |
57 | 57 | } |
58 | 58 | |
59 | - public function getSubClient(string $type, string $name = null): \Aimeos\Client\Html\Iface |
|
59 | + public function getSubClient( string $type, string $name = null ): \Aimeos\Client\Html\Iface |
|
60 | 60 | { |
61 | 61 | // TODO: Implement getSubClient() method. |
62 | 62 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
68 | 68 | * @return string HTML code |
69 | 69 | */ |
70 | - public function getBody(string $uid = ''): string |
|
70 | + public function getBody( string $uid = '' ): string |
|
71 | 71 | { |
72 | 72 | $view = $this->getView(); |
73 | 73 | |
@@ -120,30 +120,30 @@ discard block |
||
120 | 120 | /** @var \Aimeos\Controller\Frontend\Customer\Standard $cntl */ |
121 | 121 | $cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'customer' ); |
122 | 122 | $oldPassword = $cntl->get()->getPassword(); |
123 | - $values = $view->param('account', []); |
|
123 | + $values = $view->param( 'account', [] ); |
|
124 | 124 | |
125 | 125 | $isNew = $values['customer.newpassword'] !== $values['customer.oldpassword']; |
126 | 126 | $confirmed = $values['customer.newpassword'] === $values['customer.confirmnewpassword']; |
127 | 127 | |
128 | 128 | $errors = []; |
129 | 129 | |
130 | - if (!$isNew) { |
|
130 | + if( !$isNew ) { |
|
131 | 131 | $errors['isNew'] = "The given password is not new!"; |
132 | 132 | } |
133 | 133 | |
134 | - if (!$confirmed) { |
|
134 | + if( !$confirmed ) { |
|
135 | 135 | $errors["confirm"] = "New passwords doesnt match!"; |
136 | 136 | } |
137 | 137 | |
138 | - $cntl = $cntl->add($values); |
|
138 | + $cntl = $cntl->add( $values ); |
|
139 | 139 | |
140 | - if ( $oldPassword === $cntl->get()->getPassword() ) { |
|
140 | + if( $oldPassword === $cntl->get()->getPassword() ) { |
|
141 | 141 | $errors['oldPassword'] = "Wrong password!"; |
142 | 142 | } |
143 | 143 | |
144 | - $view->passwordChanged = count(array_keys($errors)) === 0; |
|
144 | + $view->passwordChanged = count( array_keys( $errors ) ) === 0; |
|
145 | 145 | |
146 | - if (count(array_keys($errors)) > 0) { |
|
146 | + if( count( array_keys( $errors ) ) > 0 ) { |
|
147 | 147 | $view->passwordErrors = $errors; |
148 | 148 | } |
149 | 149 |