1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-25 10:32:31 +01:00

Fix display of database rows when password is not available

closes #4381
This commit is contained in:
DaneEveritt 2022-09-17 11:50:40 -07:00
parent bf2456d0fc
commit e040fd1ebd
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 7 additions and 10 deletions

View File

@ -15,8 +15,7 @@ export const rawDataToServerDatabase = (data: any): ServerDatabase => ({
username: data.username,
connectionString: `${data.host.address}:${data.host.port}`,
allowConnectionsFrom: data.connections_from,
password:
data.relationships && data.relationships.password ? data.relationships.password.attributes.password : undefined,
password: data.relationships.password?.attributes?.password,
});
export default (uuid: string, includePassword = true): Promise<ServerDatabase[]> => {

View File

@ -34,6 +34,10 @@ export default ({ database, className }: Props) => {
const appendDatabase = ServerContext.useStoreActions((actions) => actions.databases.appendDatabase);
const removeDatabase = ServerContext.useStoreActions((actions) => actions.databases.removeDatabase);
const jdbcConnectionString = `jdbc:mysql://${database.username}${
database.password ? `:${database.password}` : ''
}@${database.connectionString}/${database.name}`;
const schema = object().shape({
confirm: string()
.required('The database name must be provided.')
@ -122,14 +126,8 @@ export default ({ database, className }: Props) => {
</Can>
<div css={tw`mt-6`}>
<Label>JDBC Connection String</Label>
<CopyOnClick
text={`jdbc:mysql://${database.username}:${database.password}@${database.connectionString}/${database.name}`}
>
<Input
type={'text'}
readOnly
value={`jdbc:mysql://${database.username}:${database.password}@${database.connectionString}/${database.name}`}
/>
<CopyOnClick text={jdbcConnectionString}>
<Input type={'text'} readOnly value={jdbcConnectionString} />
</CopyOnClick>
</div>
<div css={tw`mt-6 text-right`}>