pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Show WARNING,DETAIL and HINT message on login

Open sergioenterprisedb opened this issue 1 year ago • 8 comments

A customer want to use password profiles with EPAS with PASSWORD_GRACE_TIME parameter. It works fine but they will need in pgAdmin or other SQL editors a message with the WARNING, DETAIL and HINT message displayed in psql. Currently pgAdmin does not show any message on login to warn the user that he has to change the key. This is the profile that I’m testing:

CREATE PROFILE pwd_profile LIMIT
       PASSWORD_LOCK_TIME 1
       FAILED_LOGIN_ATTEMPTS 5
       PASSWORD_REUSE_TIME 365 
       PASSWORD_LIFE_TIME 0.00011 
       PASSWORD_GRACE_TIME 1;

CREATE ROLE test_user WITH LOGIN PASSWORD 'Thisisapassword1!' PROFILE pwd_profile;

And this this the psql message:

psql -h localhost -p 5444 -U test_user postgres
WARNING:  the account will expire soon; please change your password
DETAIL:  Your password will expire in 0.975414 days.
HINT:  Use ALTER ROLE to change your password.
psql (16.2, server 15.8.1)
Type "help" for help.

postgres=> 

sergioenterprisedb avatar Nov 05 '24 16:11 sergioenterprisedb

Would it make sense to have a console for these messages that are pinned to the bottom, or should it appear in a modal at login?

A modal could be weird in the case of reconnections... however, forcing a pinned console to become visible under certain circumstances could be weird UX.

jmealo avatar Nov 05 '24 16:11 jmealo

Hi team,Let me check you the customer. We have a meeting with them tomorrow.ThanksSergio Le 5 nov. 2024 à 17:15, Jeff Mealo @.***> a écrit : Would it make sense to have a console for these messages that are pinned to the bottom, or should it appear in a modal at login? A modal could be weird in the case of reconnections... however, forcing a pinned console to become visible under certain circumstances could be weird UX.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

sergioenterprisedb avatar Nov 06 '24 06:11 sergioenterprisedb

Hi Jeff, Customer wants that appear in a modal at login in pgAdmin. Question: they are using DBeaver as well. There is any posibility to do the changes as well in DBeaver? Thank you.

[signature_121622677]

Sergio Romera

Senior Manager, Sales Engineering EMEA (South)

+33.608.678.934

LinkedInhttps://www.linkedin.com/in/sergio-romera/

enterprisedb.comhttp://enterprisedb.com/

From: Jeff Mealo @.> Date: Tuesday, 5 November 2024 at 5:15 PM To: pgadmin-org/pgadmin4 @.> Cc: sergioenterprisedb @.>, Author @.> Subject: Re: [pgadmin-org/pgadmin4] Show WARNING,DETAIL and HINT message on login (Issue #8093)

Would it make sense to have a console for these messages that are pinned to the bottom, or should it appear in a modal at login?

A modal could be weird in the case of reconnections... however, forcing a pinned console to become visible under certain circumstances could be weird UX.

— Reply to this email directly, view it on GitHubhttps://github.com/pgadmin-org/pgadmin4/issues/8093#issuecomment-2457607438, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUUZIJCS6CHTI64F33A5EELZ7DVKXAVCNFSM6AAAAABRG4PEZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJXGYYDONBTHA. You are receiving this because you authored the thread.Message ID: @.***>

sergioenterprisedb avatar Nov 07 '24 15:11 sergioenterprisedb

What about a modal but with a "don't show this again for 24 hours" checkbox or something similar so it doesn't become annoying (noting that only users who are using EPAS and whose sysadmins enabled this in the first place will ever see the dialogue).

sonotley avatar Nov 08 '24 13:11 sonotley

@sergioenterprisedb can I confirm that what you're looking for here is a modal dialog that displays whenever a user connects to an EPAS server and the password used is expiring, and NOT a warning when the user logs in to pgAdmin.

sonotley avatar Nov 08 '24 13:11 sonotley

Hi @sergioenterprisedb and @sonotley

I have started a discussion thread on Psycopg3 (used by pgAdmin for connection management), as Daniele has confirmed that the code requires refactoring and welcomes a PR. Refer to the discussion here: 952.

I don’t believe this is something that can be accomplished quickly, if we find some other solution then we can work on it.

akshay-joshi avatar Nov 11 '24 13:11 akshay-joshi

Thank you Akshay for your answer. Please, keep me posted about this change.

Sergio Romera Senior Manager, Sales Engineering EMEA (South) +33.608.678.934 LinkedIn https://www.linkedin.com/in/sergio-romera/ enterprisedb.com https://www.enterprisedb.com/

On 11 Nov 2024, at 2:12 PM, Akshay Joshi @.***> wrote:

Hi @sergioenterprisedb https://github.com/sergioenterprisedb and @sonotley https://github.com/sonotley I have started a discussion thread on Psycopg3 (used by pgAdmin for connection management), as Daniele has confirmed that the code requires refactoring and welcomes a PR. Refer to the discussion here: 952 https://github.com/psycopg/psycopg/discussions/952.

I don’t believe this is something that can be accomplished quickly, if we find some other solution then we can work on it.

— Reply to this email directly, view it on GitHub https://github.com/pgadmin-org/pgadmin4/issues/8093#issuecomment-2468148582, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUUZIJB6ZRLIFZMUAFCK5UL2ACUMLAVCNFSM6AAAAABRG4PEZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRYGE2DQNJYGI. You are receiving this because you were mentioned.

sergioenterprisedb avatar Nov 12 '24 17:11 sergioenterprisedb

Hello! With the release of PostgreSQL 17, new event triggers for login events (ON login) have been introduced. This functionality allows database administrators to implement custom logic during user authentication, including generating warning messages. Example implementation:

CREATE OR REPLACE FUNCTION simple_warning()
  RETURNS event_trigger
  LANGUAGE plpgsql AS
$$
BEGIN
  RAISE WARNING 'Attention! This is simple warning';
END;
$$;

CREATE EVENT TRIGGER simple_warning_trigger
  ON login
  EXECUTE FUNCTION simple_warning();

Currently, when using psql client, these warnings are properly displayed during connection:

postgres@Ub22:~$ psql
Password for user postgres: 
WARNING:  Attention! This is simple warning
psql (17.6 (Ubuntu 17.6-1.pgdg22.04+1))
Type "help" for help.

postgres=#

However, in pgAdmin such warnings generated by login event triggers are not displayed to the user when establishing a connection. Having such functionality as handling a warning when establishing a connection to the PostgreSQL would ensure that pgAdmin provides parity with psql. And in general it would be very useful.

servalv0r avatar Aug 21 '25 13:08 servalv0r