Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Reinstate reset db password (#31033)

Joshen Lim862dee997d57
diff --git a/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsx b/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsx
index aaa0deef01d..9fb82b60a3f 100644
--- a/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsx
+++ b/apps/studio/components/interfaces/Settings/Database/DatabaseSettings/DatabaseSettings.tsx
@@ -102,135 +102,129 @@ const DatabaseSettings = () => {
}, [primaryConfig?.pool_mode])
return (
- <>
- <section id="direct-connection">
- <Panel
- className="!m-0"
- title={
- <div className="w-full flex items-center justify-between">
- <div className="flex items-center gap-x-2">
- <h5 className="mb-0">Connection parameters</h5>
- </div>
- <DatabaseSelector />
+ <section id="direct-connection">
+ <Panel
+ className="!m-0"
+ title={
+ <div className="w-full flex items-center justify-between">
+ <div className="flex items-center gap-x-2">
+ <h5 className="mb-0">Connection parameters</h5>
</div>
- }
- >
- <Panel.Content className="space-y-6">
- {isLoading &&
- Array.from({ length: 5 }).map((_, i) => (
- <div
- key={i}
- className="grid gap-2 items-center md:grid md:grid-cols-12 md:gap-x-4 w-full"
- >
- <ShimmeringLoader className="h-4 w-1/3 col-span-4" delayIndex={i} />
- <ShimmeringLoader className="h-8 w-full col-span-8" delayIndex={i} />
- </div>
- ))}
- {isError && <AlertError error={error} subject="Failed to retrieve databases" />}
- {isSuccess && (
- <>
- <div className="space-y-4">
- <UsePoolerCheckbox
- id="connection-params"
- checked={snap.usePoolerConnection}
- ipv4AddonAdded={!!ipv4Addon}
- poolingMode={poolingMode}
- onCheckedChange={snap.setUsePoolerConnection}
- onSelectPoolingMode={setPoolingMode}
- />
- {defaultPoolingMode === 'session' && poolingMode === 'transaction' && (
- <DefaultSessionModeNotice />
- )}
- {ipv4Addon !== undefined &&
- poolingMode === 'session' &&
- snap.usePoolerConnection && <IPv4AddonDirectConnectionNotice />}
- {ipv4Addon === undefined && !snap.usePoolerConnection && (
- <IPv4DeprecationNotice />
- )}
- {isMd5 && (
- <Alert_Shadcn_>
- <WarningIcon />
- <AlertTitle_Shadcn_>
- If you are connecting to your database via a GUI client, use the{' '}
- <span tabIndex={0}>connection string</span> above instead
- </AlertTitle_Shadcn_>
- <AlertDescription_Shadcn_>
- GUI clients only support database connections for Postgres 13 via a
- connection string.
- </AlertDescription_Shadcn_>
- </Alert_Shadcn_>
- )}
- </div>
- <Input
- className="input-mono"
- layout="horizontal"
- readOnly
- copy
- disabled
- value={connectionInfo.db_host}
- label="Host"
- onCopy={() => {
- handleCopy('Host')
- }}
- />
- <Input
- className="input-mono"
- layout="horizontal"
- readOnly
- copy
- disabled
- value={connectionInfo.db_name}
- label="Database name"
- />
- <Input
- className="input-mono"
- layout="horizontal"
- readOnly
- copy
- disabled
- value={poolingMode === 'transaction' ? connectionInfo.db_port : '5432'}
- label="Port"
+ <DatabaseSelector />
+ </div>
+ }
+ >
+ <Panel.Content className="space-y-6">
+ {isLoading &&
+ Array.from({ length: 5 }).map((_, i) => (
+ <div
+ key={i}
+ className="grid gap-2 items-center md:grid md:grid-cols-12 md:gap-x-4 w-full"
+ >
+ <ShimmeringLoader className="h-4 w-1/3 col-span-4" delayIndex={i} />
+ <ShimmeringLoader className="h-8 w-full col-span-8" delayIndex={i} />
+ </div>
+ ))}
+ {isError && <AlertError error={error} subject="Failed to retrieve databases" />}
+ {isSuccess && (
+ <>
+ <div className="space-y-4">
+ <UsePoolerCheckbox
+ id="connection-params"
+ checked={snap.usePoolerConnection}
+ ipv4AddonAdded={!!ipv4Addon}
+ poolingMode={poolingMode}
+ onCheckedChange={snap.setUsePoolerConnection}
+ onSelectPoolingMode={setPoolingMode}
/>
- {isMd5 && snap.usePoolerConnection && (
- <Input
- className="input-mono"
- layout="horizontal"
- readOnly
- copy
- disabled
- value={`reference=${projectRef}`}
- label="Options"
- />
+ {defaultPoolingMode === 'session' && poolingMode === 'transaction' && (
+ <DefaultSessionModeNotice />
)}
+ {ipv4Addon !== undefined &&
+ poolingMode === 'session' &&
+ snap.usePoolerConnection && <IPv4AddonDirectConnectionNotice />}
+ {ipv4Addon === undefined && !snap.usePoolerConnection && <IPv4DeprecationNotice />}
+ {isMd5 && (
+ <Alert_Shadcn_>
+ <WarningIcon />
+ <AlertTitle_Shadcn_>
+ If you are connecting to your database via a GUI client, use the{' '}
+ <span tabIndex={0}>connection string</span> above instead
+ </AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ GUI clients only support database connections for Postgres 13 via a connection
+ string.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+ )}
+ </div>
+ <Input
+ className="input-mono"
+ layout="horizontal"
+ readOnly
+ copy
+ disabled
+ value={connectionInfo.db_host}
+ label="Host"
+ onCopy={() => {
+ handleCopy('Host')
+ }}
+ />
+ <Input
+ className="input-mono"
+ layout="horizontal"
+ readOnly
+ copy
+ disabled
+ value={connectionInfo.db_name}
+ label="Database name"
+ />
+ <Input
+ className="input-mono"
+ layout="horizontal"
+ readOnly
+ copy
+ disabled
+ value={poolingMode === 'transaction' ? connectionInfo.db_port : '5432'}
+ label="Port"
+ />
+ {isMd5 && snap.usePoolerConnection && (
<Input
+ className="input-mono"
layout="horizontal"
- className="input-mono table-input-cell text-base"
readOnly
copy
disabled
- value={connectionInfo.db_user}
- label="User"
- />
- <Input
- className="input-mono"
- layout="horizontal"
- disabled
- readOnly
- value={
- state.selectedDatabaseId !== projectRef
- ? '[The password for your primary database]'
- : '[The password for your database]'
- }
- label="Password"
+ value={`reference=${projectRef}`}
+ label="Options"
/>
- </>
- )}
- </Panel.Content>
- </Panel>
- </section>
-
- <ResetDbPassword disabled={isLoading || isError} />
- </>
+ )}
+ <Input
+ layout="horizontal"
+ className="input-mono table-input-cell text-base"
+ readOnly
+ copy
+ disabled
+ value={connectionInfo.db_user}
+ label="User"
+ />
+ <Input
+ className="input-mono"
+ layout="horizontal"
+ disabled
+ readOnly
+ value={
+ state.selectedDatabaseId !== projectRef
+ ? '[The password for your primary database]'
+ : '[The password for your database]'
+ }
+ label="Password"
+ />
+ </>
+ )}
+ </Panel.Content>
+ </Panel>
+ </section>
)
}
diff --git a/apps/studio/pages/project/[ref]/settings/database.tsx b/apps/studio/pages/project/[ref]/settings/database.tsx
index 1ed247a0807..b046c5555c7 100644
--- a/apps/studio/pages/project/[ref]/settings/database.tsx
+++ b/apps/studio/pages/project/[ref]/settings/database.tsx
@@ -8,6 +8,7 @@ import BannedIPs from 'components/interfaces/Settings/Database/BannedIPs'
import { ConnectionStringMoved } from 'components/interfaces/Settings/Database/ConnectionStringMoved'
import { DatabaseReadOnlyAlert } from 'components/interfaces/Settings/Database/DatabaseReadOnlyAlert'
import { DatabaseConnectionString } from 'components/interfaces/Settings/Database/DatabaseSettings/DatabaseConnectionString'
+import ResetDbPassword from 'components/interfaces/Settings/Database/DatabaseSettings/ResetDbPassword'
import DiskSizeConfiguration from 'components/interfaces/Settings/Database/DiskSizeConfiguration'
import { PoolingModesModal } from 'components/interfaces/Settings/Database/PoolingModesModal'
import SSLConfiguration from 'components/interfaces/Settings/Database/SSLConfiguration'
@@ -43,6 +44,7 @@ const ProjectSettings: NextPageWithLayout = () => {
<DatabaseSettings />
</>
)}
+ <ResetDbPassword />
<ConnectionPooling />
</div>