Skip to content

Commit

Permalink
Merge pull request wso2#4721 from DonOmalVindula/fix/login-registrati…
Browse files Browse the repository at this point in the history
…on-bugs

Fix issues in the login and registration
  • Loading branch information
DonOmalVindula authored Nov 20, 2023
2 parents bb713a0 + 8980a39 commit 3f11b00
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 75 deletions.
26 changes: 15 additions & 11 deletions apps/console/src/extensions/configs/server-configuration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@ export const serverConfigurationConfig: ServerConfigurationConfig = {
connectorCategoriesToShow: [
ServerConfigurationsConstants.USER_ONBOARDING_CONNECTOR_ID,
ServerConfigurationsConstants.ACCOUNT_MANAGEMENT_CONNECTOR_CATEGORY_ID,
ServerConfigurationsConstants.LOGIN_ATTEMPT_SECURITY_CONNECTOR_CATEGORY_ID,
ServerConfigurationsConstants.LOGIN_ATTEMPT_SECURITY_CONNECTOR_CATEGORY_ID
],
connectorPropertiesToShow: [ "all" ],
connectorStatusViewDisabledConnectorIDs: [
ServerConfigurationsConstants.ANALYTICS_ENGINE_CONNECTOR_ID
],
connectorToggleName: {
"account-recovery": ServerConfigurationsConstants.PASSWORD_RECOVERY_NOTIFICATION_BASED_ENABLE,
"account-recovery-username": ServerConfigurationsConstants.USERNAME_RECOVERY_ENABLE,
"account.lock.handler": ServerConfigurationsConstants.ACCOUNT_LOCK_ENABLE,
"multiattribute.login.handler": ServerConfigurationsConstants.MULTI_ATTRIBUTE_LOGIN_ENABLE,
"organization-self-service": ServerConfigurationsConstants.ORGANIZATION_SELF_SERVICE_ENABLE,
"self-sign-up": ServerConfigurationsConstants.SELF_REGISTRATION_ENABLE,

"sso.login.recaptcha": ServerConfigurationsConstants.RE_CAPTCHA_AFTER_MAX_FAILED_ATTEMPTS_ENABLE
},
connectorsToHide: [
ServerConfigurationsConstants.ALTERNATIVE_LOGIN_IDENTIFIER,
Expand All @@ -85,16 +88,8 @@ export const serverConfigurationConfig: ServerConfigurationConfig = {
ServerConfigurationsConstants.SESSION_MANAGEMENT_CONNECTOR_ID,
ServerConfigurationsConstants.WS_FEDERATION_CONNECTOR_ID
],
extendedConnectors: [],
predefinedConnectorCategories: [
"UGFzc3dvcmQgUG9saWNpZXM",
"VXNlciBPbmJvYXJkaW5n",
"TG9naW4gQXR0ZW1wdHMgU2VjdXJpdHk",
"T3RoZXIgU2V0dGluZ3M",
"QWNjb3VudCBNYW5hZ2VtZW50",
"TXVsdGkgRmFjdG9yIEF1dGhlbnRpY2F0b3Jz"
],
dynamicConnectors: true,
extendedConnectors: [],
intendSettings: false,
passwordExpiryComponent: (
componentId: string,
Expand Down Expand Up @@ -122,6 +117,15 @@ export const serverConfigurationConfig: ServerConfigurationConfig = {
t
);
},
predefinedConnectorCategories: [
"UGFzc3dvcmQgUG9saWNpZXM",
"VXNlciBPbmJvYXJkaW5n",
"TG9naW4gQXR0ZW1wdHMgU2VjdXJpdHk",
"T3RoZXIgU2V0dGluZ3M",
"QWNjb3VudCBNYW5hZ2VtZW50",
"TXVsdGkgRmFjdG9yIEF1dGhlbnRpY2F0b3Jz"
],

processInitialValues: (
initialValues: ValidationFormInterface,
passwordHistoryCount: GovernanceConnectorInterface,
Expand Down
2 changes: 1 addition & 1 deletion apps/console/src/features/applications/api/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ export const getOIDCApplicationConfigurations = (): Promise<OIDCApplicationConfi
tokenEndpoint: response.data.token_endpoint,
tokenRevocationEndpoint: response.data.revocation_endpoint,
userEndpoint: response.data.userinfo_endpoint,
webFingerEndpoint: "",
webFingerEndpoint: response.data.webfinger_endpoint,
wellKnownEndpoint: `${ response.data.token_endpoint }/.well-known/openid-configuration`
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,33 +316,33 @@ export const OIDCConfigurations: FunctionComponent<OIDCConfigurationsPropsInterf
/>
</Grid.Column>
</Grid.Row>
<Grid.Row columns={ 2 }>
<Grid.Column mobile={ 8 } tablet={ 8 } computer={ 6 }>
<GenericIcon
icon={ getHelpPanelIcons().endpoints.par }
size="micro"
square
transparent
inline
className="left-icon"
verticalAlign="middle"
spaced="right"
/>
<label data-testid={ `${ testId }-pushed-authorization-request-label` }>
{ t("console:develop.features.applications.helpPanel.tabs.start.content." +
"oidcConfigurations.labels.pushedAuthorizationRequest") }
</label>
</Grid.Column>
<Grid.Column mobile={ 8 } tablet={ 8 } computer={ 10 }>
<CopyInputField
value={ oidcConfigurations?.pushedAuthorizationRequestEndpoint }
data-testid={ `${ testId }-pushed-authorization-request-readonly-input` }
/>
</Grid.Column>
</Grid.Row>
{
featureConfig?.residentIdp?.enabled && (
<>
<Grid.Row columns={ 2 }>
<Grid.Column mobile={ 8 } tablet={ 8 } computer={ 6 }>
<GenericIcon
icon={ getHelpPanelIcons().endpoints.par }
size="micro"
square
transparent
inline
className="left-icon"
verticalAlign="middle"
spaced="right"
/>
<label data-testid={ `${ testId }-pushed-authorization-request-label` }>
{ t("console:develop.features.applications.helpPanel.tabs.start.content." +
"oidcConfigurations.labels.pushedAuthorizationRequest") }
</label>
</Grid.Column>
<Grid.Column mobile={ 8 } tablet={ 8 } computer={ 10 }>
<CopyInputField
value={ oidcConfigurations?.pushedAuthorizationRequestEndpoint }
data-testid={ `${ testId }-pushed-authorization-request-readonly-input` }
/>
</Grid.Column>
</Grid.Row>
<Grid.Row columns={ 2 }>
<Grid.Column mobile={ 8 } tablet={ 8 } computer={ 6 }>
<GenericIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const Saml2ConfigurationPage: FunctionComponent<Saml2ConfigurationPageInt
const gonvernanConnectorsConfig: FeatureAccessConfigInterface = useSelector(
(state: AppState) => state?.config?.ui?.features?.governanceConnectors);
const saml2WebSSO: DeprecatedFeatureInterface = gonvernanConnectorsConfig
.deprecatedFeaturesToShow.find((feature) => {
.deprecatedFeaturesToShow.find((feature: any) => {
return feature?.name === "saml2";
});

Expand Down Expand Up @@ -326,7 +326,7 @@ export const Saml2ConfigurationPage: FunctionComponent<Saml2ConfigurationPageInt
</Grid.Column>
</Grid.Row>
{
saml2WebSSO.deprecatedProperties
saml2WebSSO?.deprecatedProperties
.includes("destinationURLs.pattern") && (
<Grid.Row columns={ 1 } key={ 2 }>
<Grid.Column width={ 10 } key="destinationUrl">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ import { hasRequiredScopes } from "@wso2is/core/helpers";
import { TestableComponentInterface } from "@wso2is/core/models";
import React, { FunctionComponent, ReactElement, useMemo } from "react";
import { useSelector } from "react-redux";
import { AdminForcedPasswordResetForm } from "./admin-forced-password-reset";
import { AnalyticsConfigurationForm } from "./analytics-form";
import { AskPasswordForm } from "./ask-password";
import { LoginAttemptSecurityConfigurationFrom } from "./login-attempt-security-form";
import { MultiAttributeLoginForm } from "./multi-attribute-login";
import { OrganizationSelfServiceForm } from "./organization-self-service-form";
import { PasswordRecoveryConfigurationForm } from "./password-recovery-form";
import { SelfRegistrationForm } from "./self-registration-form";
import { AppState, FeatureConfigInterface } from "../../core";
import { UsernameRecoveryConfigurationForm } from "./username-recovery-form";
import { AppState, FeatureConfigInterface, history } from "../../core";
import { ServerConfigurationsConstants } from "../constants/server-configurations-constants";
import { GovernanceConnectorInterface } from "../models/governance-connectors";
import { AdminForcedPasswordResetForm } from "./admin-forced-password-reset";
import { UsernameRecoveryConfigurationForm } from "./username-recovery-form";

/**
* Proptypes for the connector form factory component.
Expand Down Expand Up @@ -95,7 +95,10 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
[ featureConfig, allowedScopes ]
);

switch (connectorId) {
const path: string[] = history?.location?.pathname?.split("/");
const type: string = path && path[ path.length - 3 ];

switch (connectorId) {
case ServerConfigurationsConstants.SELF_SIGN_UP_CONNECTOR_ID:
return (
<SelfRegistrationForm
Expand All @@ -117,6 +120,18 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
/>
);
case ServerConfigurationsConstants.ACCOUNT_RECOVERY_CONNECTOR_ID:
if (type === "username") {
return (
<UsernameRecoveryConfigurationForm
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
isSubmitting={ isSubmitting }
/>
);
}

return (
<PasswordRecoveryConfigurationForm
onSubmit={ onSubmit }
Expand Down Expand Up @@ -161,7 +176,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
<MultiAttributeLoginForm
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ true }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
isSubmitting={ isSubmitting }
/>
Expand All @@ -171,7 +186,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
<AdminForcedPasswordResetForm
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ true }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
isSubmitting={ isSubmitting }
/>
Expand All @@ -181,7 +196,7 @@ export const ConnectorFormFactory: FunctionComponent<ConnectorFormFactoryInterfa
<UsernameRecoveryConfigurationForm
onSubmit={ onSubmit }
initialValues={ initialValues }
isConnectorEnabled={ true }
isConnectorEnabled={ isConnectorEnabled }
readOnly={ isReadOnly }
isSubmitting={ isSubmitting }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const UsernameRecoveryConfigurationForm: FunctionComponent<UsernameRecove

initialValues.properties.map((property: ConnectorPropertyInterface) => {
if (allowedConnectorFields.includes(property.name)) {
if (property.name === ServerConfigurationsConstants.NOTIFY_SUCCESS) {
if (property.name === ServerConfigurationsConstants.USERNAME_RECOVERY_ENABLE) {
resolvedInitialValues = {
...resolvedInitialValues,
notifySuccess: CommonUtils.parseBoolean(property.value)
Expand Down Expand Up @@ -229,8 +229,7 @@ export const UsernameRecoveryConfigurationForm: FunctionComponent<UsernameRecove
/>
<Hint className={ "mb-5" }>
{
t("extensions:manage.serverConfigurations.accountRecovery." +
"passwordRecovery.form.fields.notifySuccess.hint")
"This specifies whether to notify the user via an email when username recovery is successful"
}
</Hint>
<Field.Input
Expand Down Expand Up @@ -271,8 +270,7 @@ export const UsernameRecoveryConfigurationForm: FunctionComponent<UsernameRecove
</Field.Input>
<Hint className={ "mb-5" }>
{
t("extensions:manage.serverConfigurations.accountRecovery." +
"passwordRecovery.form.fields.expiryTime.hint")
"Username recovery link expiry time in minutes"
}
</Hint>
<Field.Button
Expand Down
Loading

0 comments on commit 3f11b00

Please sign in to comment.