Skip to content

Comments

Fix/Community-auth-fixes-frontend#1070

Open
udulaThathsaridu wants to merge 26 commits intodevelopfrom
fix/community-auth-fixes
Open

Fix/Community-auth-fixes-frontend#1070
udulaThathsaridu wants to merge 26 commits intodevelopfrom
fix/community-auth-fixes

Conversation

@udulaThathsaridu
Copy link
Contributor

@udulaThathsaridu udulaThathsaridu commented Feb 17, 2026

PR checklist

TaskId: (https://rootcode.skapp.com/pm/projects/SKAPP/items/1381)

Summary

-Community Code auth fixes for frontend

How to test

Project Checklist

  • Changes build without any errors
  • Have written adequate test cases
  • Done developer testing in
    • Chrome
    • Firefox
    • Safari
  • Code is formatted with npm run format
  • Code is linted with npm run check-lint
  • No unnecessary comments left in code
  • Made corresponding changes to the documentation

Other

  • New atomic components added
  • New molecules added
  • New pages(routes) added
  • New dependencies installed

PR Checklist

  • Pull request is raised from the correct source branch
  • Pull request is raised to the correct destination branch
  • Pull request is raised with correct title
  • Pull request is self reviewed
  • Pull request is self assigned
  • Suitable pull request status labels are added (ready-for-code-review)

Additional Information

BojithaPiyathilake and others added 24 commits August 25, 2025 20:54
# Conflicts:
#	backend/src/main/java/com/skapp/community/peopleplanner/service/impl/RolesServiceImpl.java
@udulaThathsaridu udulaThathsaridu self-assigned this Feb 17, 2026
Copilot AI review requested due to automatic review settings February 17, 2026 10:13
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements authentication fixes for the community edition of the application. It separates community authentication logic from enterprise features by introducing fallback implementations for enterprise-specific functionality and implementing credential-based sign-in/sign-up for the community edition.

Changes:

  • Added fallback implementations for enterprise features (auth utilities, enums, API endpoints, calendar hooks, and APICTA dashboard)
  • Implemented community-specific sign-in and sign-up functions with proper API endpoints
  • Updated authentication flow to conditionally add tenant headers only in enterprise mode
  • Fixed sign-in/sign-up status checks to properly access the status property from the response object

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/fallback/common/utils/commonUtil.ts Adds fallback stubs for enterprise utility functions
frontend/src/fallback/common/enums/Common.ts Provides empty enum stubs for enterprise-specific enums
frontend/src/fallback/common/api/utils/ApiEndpoints.ts Adds empty authentication endpoints object for fallback
frontend/src/fallback/common/api/CalendarApi.ts Implements fallback calendar organization status hook
frontend/src/fallback/auth/utils/authUtils.ts Provides stub implementations for enterprise auth functions that always return failure
frontend/src/fallback/APICTA/dashboard.tsx Creates empty APICTA dashboard component for fallback
frontend/src/community/common/utils/commonUtil.ts Adds utility to check if running in enterprise mode
frontend/src/community/common/api/utils/ApiEndpoints.ts Adds new credential-based sign-in/sign-up API endpoints
frontend/src/community/auth/utils/authUtils.ts Implements community sign-in/sign-up functions with proper API integration
frontend/src/community/auth/utils/authInterceptor.ts Conditionally adds tenant header only in enterprise mode
frontend/src/community/auth/types/auth.ts Defines community-specific sign-in/sign-up parameter types
frontend/pages/index.tsx Reorders imports (no functional change)
frontend/pages/community/signup.tsx Fixes status check to access status property from result object
frontend/pages/community/signin.tsx Fixes status check to access status property from result object
frontend/middleware.ts Removes community routes from middleware matcher to allow public access to auth pages

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +295 to +299
} catch (error: any) {
return {
status: SignInStatus.FAILURE,
error: error?.response?.data?.[0]?.messageKey
};
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling assumes a specific error response structure error?.response?.data?.[0]?.messageKey, but if the API returns errors in a different format, the messageKey might be undefined. Consider adding a fallback error message or validating the error structure more robustly to prevent returning undefined as the error message.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as enterprise

return false;
};

export const tempShouldUseCustomDashboard = () => {
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function signature of tempShouldUseCustomDashboard is inconsistent with its usage. In frontend/pages/community/dashboard/index.tsx line 159, this function is called with a parameter user?.tenantId, but the function doesn't accept any parameters. The function signature should match the expected usage: tempShouldUseCustomDashboard = (tenantId?: string | number) => boolean

Suggested change
export const tempShouldUseCustomDashboard = () => {
export const tempShouldUseCustomDashboard = (tenantId?: string | number): boolean => {

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed since is a fallback file

Comment on lines 305 to 308
matcher: [
// All community routes
"/community/:path*",
// Super admin routes
"/setup-organization/:path*",
"/module-selection",
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the community routes matcher "/community/:path*" from the middleware configuration means that pages under /community/signin and /community/signup will no longer be protected by the middleware. This could be intentional to allow public access to these auth pages, but it's a significant change. If this is intentional, ensure that these pages don't contain any logic that requires middleware protection. If unintentional, this could be a security issue.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was done to allow sign in and sign up to not be protected

Comment on lines +272 to +276
} catch (error: any) {
return {
status: SignInStatus.FAILURE,
error: error?.response?.data?.[0]?.messageKey
};
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling assumes a specific error response structure error?.response?.data?.[0]?.messageKey, but if the API returns errors in a different format, the messageKey might be undefined. Consider adding a fallback error message or validating the error structure more robustly to prevent returning undefined as the error message.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as enterprise

} No newline at end of file
}
export interface CommunitySignInParams {
email?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove option

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as enterprise

export interface CommunitySignUpParams {
firstName?: string;
lastName?: string;
email?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove option for required fields

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as enterprise

export const authenticationEndpoints = {
CREATE_SUPER_ADMIN: `${moduleAPIPath.AUTH}/signup/super-admin`,
SIGN_IN: `${moduleAPIPath.AUTH}/sign-in`,
CREDENTIAL_SIGN_IN: `${ApiVersions.V1}/auth/session/sign-in`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the old end points

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove from BE as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the end points

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -12,6 +15,8 @@ export const organizationCreateEndpoints = {
export const authenticationEndpoints = {
CREATE_SUPER_ADMIN: `${moduleAPIPath.AUTH}/signup/super-admin`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check in mobile if not using remove from backend

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need sign in but create SUPER admin is not needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and its already deleted in backend

@@ -0,0 +1,5 @@
const APICTADashboard = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

branch out for future reference and remove all APICTA UIs
remove all the related utils as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,29 @@
import { SignInStatus } from "~community/auth/enums/auth";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we believe the file can make empty
enterpriseSignIn , enterpriseSignUp only needed with empty body

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sonarqubecloud
Copy link

@ThinuwanW ThinuwanW changed the base branch from main to develop February 19, 2026 05:02
matcher: [
// All community routes
"/community/:path*",
// All community routes (excluding public auth pages)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets check what is the rootcause

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants