Skip to content

Commit 0b2df8e

Browse files
committed
fix: fields value not set to state
1 parent 0903b91 commit 0b2df8e

File tree

3 files changed

+37
-28
lines changed

3 files changed

+37
-28
lines changed

admin-ui/plugins/auth-server/components/Clients/ClientAdvancedPanel.js

+15-10
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
2020
const contacts = []
2121
const claimRedirectURI = []
2222
const requestUris = []
23-
const authorizedOrigins = client.authorizedOrigins || []
23+
const authorizedOrigins = []
2424
scripts = scripts
2525
.filter((item) => item.scriptType == 'PERSON_AUTHENTICATION')
2626
.filter((item) => item.enabled)
@@ -167,12 +167,13 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
167167
<GluuLabel label="fields.show_software_settings" size={6} />
168168
<Col sm={2}>
169169
<Toggle
170-
defaultChecked={softwareSection}
171-
onChange={handleSoftwareSection}
170+
name="softwareSection"
171+
defaultChecked={client.softwareSection}
172+
onChange={formik.handleChange}
172173
/>
173174
</Col>
174175
</FormGroup>
175-
{softwareSection && (
176+
{client.softwareSection && (
176177
<GluuInputRow
177178
label="fields.softwareId"
178179
name="softwareId"
@@ -181,7 +182,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
181182
doc_category={DOC_CATEGORY}
182183
/>
183184
)}
184-
{softwareSection && (
185+
{client.softwareSection && (
185186
<GluuInputRow
186187
label="fields.softwareVersion"
187188
name="softwareVersion"
@@ -190,7 +191,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
190191
doc_category={DOC_CATEGORY}
191192
/>
192193
)}
193-
{softwareSection && (
194+
{client.softwareSection && (
194195
<GluuInputRow
195196
label="fields.softwareStatement"
196197
name="softwareStatement"
@@ -202,10 +203,14 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
202203
<FormGroup row>
203204
<GluuLabel label="fields.show_ciba_settings" size={6} />
204205
<Col sm={6}>
205-
<Toggle defaultChecked={cibaSection} onChange={handleCibaSection} />
206+
<Toggle
207+
name="cibaSection"
208+
defaultChecked={client.cibaSection}
209+
onChange={formik.handleChange}
210+
/>
206211
</Col>
207212
</FormGroup>
208-
{cibaSection && (
213+
{client.cibaSection && (
209214
<GluuSelectRow
210215
name="backchannelTokenDeliveryMode"
211216
label="fields.backchannelTokenDeliveryMode"
@@ -215,7 +220,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
215220
doc_category={DOC_CATEGORY}
216221
></GluuSelectRow>
217222
)}
218-
{cibaSection && (
223+
{client.cibaSection && (
219224
<GluuInputRow
220225
label="fields.backchannelClientNotificationEndpoint"
221226
name="backchannelClientNotificationEndpoint"
@@ -224,7 +229,7 @@ function ClientAdvancedPanel({ client, scripts, formik }) {
224229
doc_category={DOC_CATEGORY}
225230
/>
226231
)}
227-
{cibaSection && (
232+
{client.cibaSection && (
228233
<GluuToogleRow
229234
name="backchannelUserCodeParameter"
230235
formik={formik}

admin-ui/plugins/auth-server/components/Clients/ClientBasicPanel.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ const ClientBasicPanel = ({ client, scopes, formik }) => {
141141
name="expirable"
142142
formik={formik}
143143
label="fields.is_expirable_client"
144-
value={expirable}
144+
value={client.expirable && client.expirable.length ? true : false}
145145
handler={handleExpirable}
146146
doc_category={DOC_CATEGORY}
147147
/>
148148

149-
{expirable && (
149+
{client.expirable && client.expirable.length && (
150150
<FormGroup row>
151151
<GluuLabel label="client_expiration_date" size={5} />
152152
<Col sm={7}>
@@ -156,12 +156,12 @@ const ClientBasicPanel = ({ client, scopes, formik }) => {
156156
showTimeSelect
157157
dateFormat="yyyy-MM-dd HH:mm:aa"
158158
timeFormat="HH:mm:aa"
159-
selected={expDate}
159+
selected={client.expirationDate}
160160
peekNextMonth
161161
showMonthDropdown
162162
showYearDropdown
163163
dropdownMode="select"
164-
onChange={(date) => setExpDate(date)}
164+
onChange={(e) => formik.setFieldValue('expirationDate', e)}
165165
/>
166166
</Col>
167167
</FormGroup>

admin-ui/plugins/auth-server/components/Clients/ClientWizardForm.js

+18-14
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function ClientWizardForm({
115115
}
116116
return total.filter((item) => partial.includes(item.dn)) || []
117117
}
118-
client.description = extractDescription(client.customAttributes || [])
118+
// client.description = extractDescription(client.customAttributes || [])
119119
client.spontaneousScopes =
120120
getMapping(client.attributes.spontaneousScopes, scopes) || []
121121
client.introspectionScripts =
@@ -133,19 +133,19 @@ function ClientWizardForm({
133133
getMapping(client.attributes.postAuthnScripts, postScripts) || []
134134
client.rptClaimsScripts =
135135
getMapping(client.attributes.rptClaimsScripts, rptScripts) || []
136-
client.tlsClientAuthSubjectDn = client.attributes.tlsClientAuthSubjectDn
137-
client.runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims =
138-
client.attributes
139-
.runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims ||
140-
false
141-
client.backchannelLogoutSessionRequired =
142-
client.attributes.backchannelLogoutSessionRequired || false
143-
client.keepClientAuthorizationAfterExpiration =
144-
client.attributes.keepClientAuthorizationAfterExpiration || false
145-
client.allowSpontaneousScopes =
146-
client.attributes.allowSpontaneousScopes || false
147-
client.additionalAudience = client.attributes.additionalAudience || []
148-
client.backchannelLogoutUri = client.attributes.backchannelLogoutUri
136+
// client.tlsClientAuthSubjectDn = client.attributes.tlsClientAuthSubjectDn
137+
// client.runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims =
138+
// client.attributes
139+
// .runIntrospectionScriptBeforeAccessTokenAsJwtCreationAndIncludeClaims ||
140+
// false
141+
// client.backchannelLogoutSessionRequired =
142+
// client.attributes.backchannelLogoutSessionRequired || false
143+
// client.keepClientAuthorizationAfterExpiration =
144+
// client.attributes.keepClientAuthorizationAfterExpiration || false
145+
// client.allowSpontaneousScopes =
146+
// client.attributes.allowSpontaneousScopes || false
147+
// client.additionalAudience = client.attributes.additionalAudience || []
148+
// client.backchannelLogoutUri = client.attributes.backchannelLogoutUri
149149

150150
const initialValues = {
151151
inum: client.inum,
@@ -164,9 +164,13 @@ function ClientWizardForm({
164164
tosUri: client.tosUri,
165165
jwksUri: client.jwksUri,
166166
jwks: client.jwks,
167+
expirable: [],
168+
expirationDate: new Date(),
167169
softwareStatement: client.softwareStatement,
168170
softwareVersion: client.softwareVersion,
169171
softwareId: client.softwareId,
172+
softwareSection: client.softwareSection ? client.softwareSection : false,
173+
cibaSection: client.cibaSection ? client.cibaSection : false,
170174
idTokenSignedResponseAlg: client.idTokenSignedResponseAlg,
171175
idTokenEncryptedResponseAlg: client.idTokenEncryptedResponseAlg,
172176
tokenEndpointAuthMethod: client.tokenEndpointAuthMethod,

0 commit comments

Comments
 (0)