Skip to content

Commit

Permalink
chore: Updating the login button names for OIDC & SAML to get it from…
Browse files Browse the repository at this point in the history
… tenant config (#32979)

## Description

Updating the login button names for OIDC & SAML to get it from tenant
config

Fixes [#25660](#25660)

## Automation

/ok-to-test tags="@tag.Settings"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/9073688267>
> Commit: f8c0454
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9073688267&attempt=1"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->




## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Improved admin settings management by removing redundant data fetching
in the super user functionalities.

- **New Features**
- Enhanced third-party authentication by dynamically updating social
login button labels based on tenant configurations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
ankitakinger committed May 15, 2024
1 parent 1e23643 commit 62ffaf8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 0 additions & 3 deletions app/client/src/ce/sagas/SuperUserSagas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from "@appsmith/constants/messages";
import { getCurrentUser } from "selectors/usersSelectors";
import { EMAIL_SETUP_DOC } from "constants/ThirdPartyConstants";
import { getCurrentTenant } from "@appsmith/actions/tenantActions";
import { toast } from "design-system";
import AnalyticsUtil from "@appsmith/utils/AnalyticsUtil";
import {
Expand Down Expand Up @@ -117,8 +116,6 @@ export function* SaveAdminSettingsSaga(
type: ReduxActionTypes.SAVE_ADMIN_SETTINGS_SUCCESS,
});

yield put(getCurrentTenant());

yield put({
type: ReduxActionTypes.FETCH_ADMIN_SETTINGS_SUCCESS,
payload: settings,
Expand Down
1 change: 1 addition & 0 deletions app/client/src/pages/AdminSettings/DisconnectService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function DisconnectService(props: {
<Callout kind="error">{props.warning}</Callout>
<Button
data-testid="disconnect-service-button"
isLoading={disconnectCalled}
kind="error"
onClick={() =>
warnDisconnectAuth ? callDisconnect() : setWarnDisconnectAuth(true)
Expand Down
14 changes: 12 additions & 2 deletions app/client/src/pages/UserAuth/ThirdPartyAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import PerformanceTracker, {
PerformanceTransactionName,
} from "utils/PerformanceTracker";
import { Button } from "design-system";
import { isTenantConfig } from "@appsmith/utils/adminSettingsHelpers";
import { useSelector } from "react-redux";
import { getTenantConfig } from "@appsmith/selectors/tenantSelectors";

const ThirdPartyAuthWrapper = styled.div`
display: flex;
Expand All @@ -34,16 +37,23 @@ function SocialLoginButton(props: {
logo: string;
name: string;
url: string;
label?: string;
type: SignInType;
}) {
const tenantConfiguration = useSelector(getTenantConfig);
const location = useLocation();
const queryParams = new URLSearchParams(location.search);
let url = props.url;
const redirectUrl = queryParams.get("redirectUrl");
if (redirectUrl != null) {
url += `?redirectUrl=${encodeURIComponent(redirectUrl)}`;
}

let buttonLabel = props.name;

if (props.name && isTenantConfig(props.name)) {
buttonLabel = tenantConfiguration[props.name];
}

return (
<StyledButton
href={url}
Expand Down Expand Up @@ -72,7 +82,7 @@ function SocialLoginButton(props: {
}
>
<div className="login-method" data-testid={`login-with-${props.name}`}>
{props.label ?? `${props.name}`}
{buttonLabel}
</div>
</StyledButton>
);
Expand Down

0 comments on commit 62ffaf8

Please sign in to comment.