Skip to content

feat(auth): display server-side auth config status on signin/signup - #3642

Merged
PierreBrisorgueil merged 5 commits into
masterfrom
feat/auth-server-config
Mar 9, 2026
Merged

feat(auth): display server-side auth config status on signin/signup#3642
PierreBrisorgueil merged 5 commits into
masterfrom
feat/auth-server-config

Conversation

@PierreBrisorgueil

@PierreBrisorgueil PierreBrisorgueil commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • What changed: Added serverConfig state and fetchServerConfig() action to the auth store. Signin and signup views now fetch the server auth config on mount and display a warning alert when sign.in or sign.up is disabled, hiding the form.
  • Why: When signin/signup is disabled in the Node backend, the frontend still showed the form, leading users to fill it out and get an error. This provides immediate visual feedback instead.
  • Related issues: Closes feat(auth): display server-side auth config status on signin/signup #3641

Scope

  • Modules impacted: auth (store, signin view, signup view, tests)
  • Cross-module impact: none
  • Risk level: low

Validation

  • npm run lint
  • npm run test:unit
  • npm run build
  • Manual checks done (if applicable)

Guardrails check

  • No secrets or credentials introduced (.env*, secrets/**, keys, tokens)
  • No risky rename/move of core stack paths
  • Changes remain merge-friendly for downstream projects
  • Tests added or updated when behavior changed

Notes for reviewers

  • Security considerations: The /api/auth/config endpoint is a public GET route exposing only boolean flags (sign.in, sign.up). No sensitive data is fetched.
  • Mergeability considerations: Changes are additive and confined to the auth module. No existing behavior is altered when the backend does not expose this endpoint (serverConfig stays null, form renders normally).
  • Follow-up tasks (optional): none

Summary by CodeRabbit

  • New Features

    • Sign-in and sign-up views now respect server-side feature configuration
    • Users receive alerts when sign-in or sign-up is disabled by server settings
  • Tests

    • Added test coverage for server configuration fetching and feature availability checks

@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@PierreBrisorgueil has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f1fe1e6-e482-4c77-91de-0b2cf0f03cba

📥 Commits

Reviewing files that changed from the base of the PR and between 226536c and a6afeca.

📒 Files selected for processing (6)
  • src/modules/auth/stores/auth.store.js
  • src/modules/auth/tests/auth.signin.view.spec.js
  • src/modules/auth/tests/auth.signup.view.spec.js
  • src/modules/auth/tests/auth.store.spec.js
  • src/modules/auth/views/auth.signin.view.vue
  • src/modules/auth/views/auth.signup.view.vue
📝 Walkthrough

Walkthrough

This PR implements server-side authentication configuration status checking. A new fetchServerConfig action is added to the auth store to retrieve /config. The signin and signup views now fetch this configuration on page load and conditionally display alerts and hide forms when signin or signup are disabled server-side.

Changes

Cohort / File(s) Summary
Auth Store & Tests
src/modules/auth/stores/auth.store.js, src/modules/auth/tests/auth.store.spec.js
Added serverConfig state and new fetchServerConfig() action that fetches /api/auth/config, updates state with response data, and returns it; on error, clears state and returns null. Comprehensive test coverage for both success and error paths.
Auth Sign-in
src/modules/auth/views/auth.signin.view.vue, src/modules/auth/tests/auth.signin.view.spec.js
Added serverConfig data property; fetches config in created() lifecycle hook; conditionally displays alert when sign-in is disabled and renders form only when enabled or config unavailable. Updated mock to expose new store properties.
Auth Sign-up
src/modules/auth/views/auth.signup.view.vue, src/modules/auth/tests/auth.signup.view.spec.js
Mirrors signin implementation with serverConfig property and lifecycle fetch; conditionally displays alert for disabled sign-up and renders form based on server config status. Updated mock to expose new store properties.

Possibly related issues

  • Node#3209: Provides the backend implementation of the /config endpoint that supplies the sign-in and sign-up enable/disable flags consumed by this frontend feature.

Suggested labels

Tests

Poem

🐰 Config whispers from afar,
Server wisdom, our guiding star,
Signin and signup bend to fate,
Hidden forms when signs debate! 🔐

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding server-side auth config status display on signin/signup views.
Description check ✅ Passed The description follows the template structure, includes all key sections (summary, scope, validation, guardrails), and provides comprehensive context for the changes.
Linked Issues check ✅ Passed The PR implementation fully addresses issue #3641: serverConfig state and fetchServerConfig action [store], server config fetching on mount [views], and conditional rendering with warning alerts [views] are all implemented.
Out of Scope Changes check ✅ Passed All changes are in-scope: serverConfig state/action in store, conditional rendering in views, and test updates for the auth module align with the issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/auth-server-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.55%. Comparing base (793d224) to head (a6afeca).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3642      +/-   ##
==========================================
+ Coverage   98.52%   98.55%   +0.03%     
==========================================
  Files          19       19              
  Lines         473      485      +12     
  Branches      119      121       +2     
==========================================
+ Hits          466      478      +12     
  Misses          7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil
PierreBrisorgueil marked this pull request as ready for review March 9, 2026 08:01
Copilot AI review requested due to automatic review settings March 9, 2026 08:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds frontend awareness of server-side auth enablement flags so the signin/signup pages can hide their forms and show a warning when the backend disables those flows (per #3641).

Changes:

  • Added serverConfig state and a fetchServerConfig() action to the auth Pinia store.
  • Updated signin/signup views to fetch server auth config on creation and conditionally render an alert vs. the form.
  • Updated/extended unit tests to account for the new store state/action.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/modules/auth/stores/auth.store.js Adds serverConfig state and fetchServerConfig() action that calls the new public API endpoint.
src/modules/auth/views/auth.signin.view.vue Fetches server config and conditionally shows a warning + hides signin form when disabled.
src/modules/auth/views/auth.signup.view.vue Fetches server config and conditionally shows a warning + hides signup form when disabled.
src/modules/auth/tests/auth.store.spec.js Adds unit coverage for default serverConfig state and fetchServerConfig() behavior.
src/modules/auth/tests/auth.signin.view.spec.js Updates auth store mock to include serverConfig + fetchServerConfig().
src/modules/auth/tests/auth.signup.view.spec.js Updates auth store mock to include serverConfig + fetchServerConfig().

Comment thread src/modules/auth/views/auth.signin.view.vue Outdated
Comment thread src/modules/auth/views/auth.signup.view.vue Outdated
Comment thread src/modules/auth/views/auth.signin.view.vue Outdated
Comment thread src/modules/auth/views/auth.signin.view.vue
Comment thread src/modules/auth/views/auth.signup.view.vue Outdated
Comment thread src/modules/auth/views/auth.signup.view.vue
Comment thread src/modules/auth/stores/auth.store.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/modules/auth/views/auth.signup.view.vue (1)

70-90: ⚠️ Potential issue | 🟡 Minor

Add the required JSDoc blocks for the modified hooks.

data() and the new async created() hook are both modified functions, but neither has the repo-required JSDoc header.

As per coding guidelines src/**/*.{js,ts,vue}: Every new or modified function must have a JSDoc header with one-line description, @param for each argument, and @returns for any non-void return value (always include @returns for async functions).

Also applies to: 106-110

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/modules/auth/views/auth.signup.view.vue` around lines 70 - 90, Add JSDoc
headers to the modified data() and created() functions in this Vue component:
for each function include a one-line description, an `@param` for each argument
(even if none, document as `@param` {void} or `@param` _unused), and an `@returns`
describing the return type (for data() the returned state object, and for async
created() include `@returns` {Promise<void>} or appropriate promise type); ensure
headers follow the repo convention and appear immediately above the data() and
created() function definitions.
src/modules/auth/views/auth.signin.view.vue (1)

74-90: ⚠️ Potential issue | 🟡 Minor

Add the required JSDoc blocks for the modified hooks.

data() and the new async created() hook are modified functions without JSDoc headers.

As per coding guidelines src/**/*.{js,ts,vue}: Every new or modified function must have a JSDoc header with one-line description, @param for each argument, and @returns for any non-void return value (always include @returns for async functions).

Also applies to: 106-110

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/modules/auth/views/auth.signin.view.vue` around lines 74 - 90, Add JSDoc
headers for the modified Vue component hooks data() and the async created() so
they follow project guidelines: for each function (data and created) add a
one-line description, include `@param` tags for any arguments (even if none,
document as none or omit params per project convention) and include `@returns`
describing the return value (for data() return object shape, and for async
created() include `@returns` Promise<void> or the actual Promise result). Ensure
the JSDoc appears immediately above the function definitions (data() and
created()) and covers any changed behavior or returned values referenced in the
function body.
🧹 Nitpick comments (2)
src/modules/auth/tests/auth.signin.view.spec.js (1)

7-9: Please cover the disabled-signin path here.

This suite now knows about fetchServerConfig(), but it still doesn't verify the new behavior introduced by the PR. Add a mount-time case where the fetched config sets sign.in: false, then assert the warning is shown and the signin form is not rendered.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/modules/auth/tests/auth.signin.view.spec.js` around lines 7 - 9, Add a
test case that mocks useAuthStore to have fetchServerConfig return a
serverConfig object with sign: { in: false } at mount time, then mount the
SignIn view/component and assert that the "signin disabled" warning is rendered
and the signin form elements are not present; update the vi.mock call
(useAuthStore, fetchServerConfig, signinMock) in auth.signin.view.spec.js to
include this scenario, mount the component (the same helper used elsewhere in
the file), await any pending promises, and use assertions to check the warning
is visible and the signin form is not rendered.
src/modules/auth/tests/auth.signup.view.spec.js (1)

7-9: Please cover the disabled-signup path here.

This mock update is necessary, but the suite still never asserts the new behavior from this PR. Add a case where fetchServerConfig() resolves a config with sign.up: false, then verify the warning is rendered and the <v-form> is hidden.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/modules/auth/tests/auth.signup.view.spec.js` around lines 7 - 9, Add a
new test in auth.signup.view.spec.js that covers the disabled-signup path by
having the mocked useAuthStore's fetchServerConfig resolve to a config object
with sign.up: false (e.g., make fetchServerConfig.mockResolvedValue({ sign: {
up: false } }) for that test), then mount/render the signup view, await any
async resolution, and assert that the warning message is rendered and that the
<v-form> is not present; reference the existing useAuthStore / signupMock /
fetchServerConfig mocks so you only override fetchServerConfig for this test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/modules/auth/views/auth.signin.view.vue`:
- Around line 10-11: The signin form is rendered before the async config loads
because serverConfig starts as null; add an explicit ready flag (e.g.,
serverConfigReady or configLoaded) and use it to gate both the v-alert and the
v-form (render only when serverConfigReady is true and then check
serverConfig.sign.in), update the template conditions around v-alert and v-form
to include this flag, set serverConfigReady = false in the data() function and
flip it to true at the end of the async created() hook after loading
serverConfig, and add JSDoc headers to the modified data() and created()
functions as per coding guidelines; look for the symbols serverConfig, data(),
created(), and the v-form/v-alert template lines to apply the change.

In `@src/modules/auth/views/auth.signup.view.vue`:
- Around line 10-11: The signup form flashes because it renders before the async
config request completes; change the template condition to only show/hide the
form after the config has settled (introduce a boolean like serverConfigLoaded
or use serverConfig !== null) and update the v-if on the <v-form> (currently
using serverConfig and serverConfig.sign.up) to require the loaded flag and
serverConfig.sign.up, and show the warning only when loaded &&
!serverConfig.sign.up; also add JSDoc headers for the Vue Options API methods:
add proper JSDoc comments above the data() function and the async created() hook
(referenced as data() and created()) describing return types and purpose.

---

Outside diff comments:
In `@src/modules/auth/views/auth.signin.view.vue`:
- Around line 74-90: Add JSDoc headers for the modified Vue component hooks
data() and the async created() so they follow project guidelines: for each
function (data and created) add a one-line description, include `@param` tags for
any arguments (even if none, document as none or omit params per project
convention) and include `@returns` describing the return value (for data() return
object shape, and for async created() include `@returns` Promise<void> or the
actual Promise result). Ensure the JSDoc appears immediately above the function
definitions (data() and created()) and covers any changed behavior or returned
values referenced in the function body.

In `@src/modules/auth/views/auth.signup.view.vue`:
- Around line 70-90: Add JSDoc headers to the modified data() and created()
functions in this Vue component: for each function include a one-line
description, an `@param` for each argument (even if none, document as `@param`
{void} or `@param` _unused), and an `@returns` describing the return type (for
data() the returned state object, and for async created() include `@returns`
{Promise<void>} or appropriate promise type); ensure headers follow the repo
convention and appear immediately above the data() and created() function
definitions.

---

Nitpick comments:
In `@src/modules/auth/tests/auth.signin.view.spec.js`:
- Around line 7-9: Add a test case that mocks useAuthStore to have
fetchServerConfig return a serverConfig object with sign: { in: false } at mount
time, then mount the SignIn view/component and assert that the "signin disabled"
warning is rendered and the signin form elements are not present; update the
vi.mock call (useAuthStore, fetchServerConfig, signinMock) in
auth.signin.view.spec.js to include this scenario, mount the component (the same
helper used elsewhere in the file), await any pending promises, and use
assertions to check the warning is visible and the signin form is not rendered.

In `@src/modules/auth/tests/auth.signup.view.spec.js`:
- Around line 7-9: Add a new test in auth.signup.view.spec.js that covers the
disabled-signup path by having the mocked useAuthStore's fetchServerConfig
resolve to a config object with sign.up: false (e.g., make
fetchServerConfig.mockResolvedValue({ sign: { up: false } }) for that test),
then mount/render the signup view, await any async resolution, and assert that
the warning message is rendered and that the <v-form> is not present; reference
the existing useAuthStore / signupMock / fetchServerConfig mocks so you only
override fetchServerConfig for this test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6d537636-1f20-481b-807b-9aa94887747c

📥 Commits

Reviewing files that changed from the base of the PR and between 793d224 and 226536c.

📒 Files selected for processing (6)
  • src/modules/auth/stores/auth.store.js
  • src/modules/auth/tests/auth.signin.view.spec.js
  • src/modules/auth/tests/auth.signup.view.spec.js
  • src/modules/auth/tests/auth.store.spec.js
  • src/modules/auth/views/auth.signin.view.vue
  • src/modules/auth/views/auth.signup.view.vue

Comment thread src/modules/auth/views/auth.signin.view.vue Outdated
Comment thread src/modules/auth/views/auth.signup.view.vue Outdated
@PierreBrisorgueil
PierreBrisorgueil merged commit 713fb00 into master Mar 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(auth): display server-side auth config status on signin/signup

2 participants