Skip to content

Conversation

@d-alex171
Copy link
Contributor

No description provided.

@theosiemensrhodes
Copy link
Collaborator

@greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 31, 2026

Greptile Overview

Greptile Summary

This PR implements a security settings dialog with password change functionality, session management, and logout features. The implementation adds a complete UI for security controls within the settings dialog.

Key changes:

  • Added password change form with current/new/confirm password fields
  • Implemented session revocation for other devices
  • Added logout functionality with visual feedback
  • Fixed dialog overflow issue to enable proper scrolling

Issues found:

  • Auth client is instantiated incorrectly - should use the shared instance from @/lib/auth/client instead of creating a new one with createAuthClient() from better-auth/client
  • Auth client is recreated on every render which is inefficient
  • Password change button allows submission with empty fields

Confidence Score: 3/5

  • This PR has important functionality but contains auth client instantiation issues that need correction before merge.
  • The auth client instantiation bug on line 2 and 20 is critical - using createAuthClient() from better-auth/client instead of the shared authClient from @/lib/auth/client may cause configuration inconsistencies. Additionally, recreating the client on every render impacts performance.
  • src/components/settings/pages/security-settings-content.tsx needs the auth client import corrected and memoization added.

Important Files Changed

Filename Overview
src/components/settings/pages/security-settings-content.tsx Implemented security settings UI with password change and session management. Has auth client instantiation issue and missing input validation.
src/components/settings/settings-dialog.tsx Changed overflow behavior from overflow-hidden to overflow-y-auto to fix dialog scrolling.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

const [loading, setLoading] = useState(false);
const [message, setMessage] = useState<{ type: 'success' | 'error'; text: string } | null>(null);

const authClient = createAuthClient()
Copy link

Choose a reason for hiding this comment

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

Creates a new auth client instance on every render. Move outside component or memoize.

Suggested change
const authClient = createAuthClient()
const authClient = React.useMemo(() => createAuthClient(), []);
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/components/settings/pages/security-settings-content.tsx
Line: 20:20

Comment:
Creates a new auth client instance on every render. Move outside component or memoize.

```suggestion
  const authClient = React.useMemo(() => createAuthClient(), []);
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah this is really important, you should just import it from where greptile mentioned

@@ -1,3 +1,188 @@
import React, { useState } from 'react';
import { createAuthClient } from 'better-auth/client';
Copy link

Choose a reason for hiding this comment

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

Importing from better-auth/client but existing codebase uses better-auth/react (see src/lib/auth/client.ts:3). Use the shared authClient from @/lib/auth/client instead of creating a new instance.

Suggested change
import { createAuthClient } from 'better-auth/client';
import { authClient } from '@/lib/auth/client';

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/components/settings/pages/security-settings-content.tsx
Line: 2:2

Comment:
Importing from `better-auth/client` but existing codebase uses `better-auth/react` (see `src/lib/auth/client.ts:3`). Use the shared `authClient` from `@/lib/auth/client` instead of creating a new instance.

```suggestion
import { authClient } from '@/lib/auth/client';
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

disabled={loading}
/>
</div>
<Button onClick={handleChangePassword} disabled={loading}>
Copy link

Choose a reason for hiding this comment

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

Button is not disabled when required fields are empty. Users can submit with empty passwords.

Suggested change
<Button onClick={handleChangePassword} disabled={loading}>
<Button onClick={handleChangePassword} disabled={loading || !currentPassword || !newPassword || !confirmPassword}>
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/components/settings/pages/security-settings-content.tsx
Line: 128:128

Comment:
Button is not disabled when required fields are empty. Users can submit with empty passwords.

```suggestion
            <Button onClick={handleChangePassword} disabled={loading || !currentPassword || !newPassword || !confirmPassword}>
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Collaborator

@theosiemensrhodes theosiemensrhodes left a comment

Choose a reason for hiding this comment

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

Looks mostly good just fix the comments

<div className="space-y-4">
<div className="space-y-2">
<Label htmlFor="current-password">Current Password</Label>
<Input
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have a way to do forms that isn't manual. See the login and signup pages for examples.

const [loading, setLoading] = useState(false);
const [message, setMessage] = useState<{ type: 'success' | 'error'; text: string } | null>(null);

const authClient = createAuthClient()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah this is really important, you should just import it from where greptile mentioned

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.

3 participants