Request new user to change password on login

On a fresh Grafana install, when the admin user logs in the first time, they are presented with a password change prompt:

Is it possible to have a similar prompt presented for other users? Specifically, I’m interested in creating a user and assigning them a temporary password - and would like to have Grafana ask them to change it the first time they log in.

I poked around the user table in the Grafana DB but nothing there catches my eye as a flag that might trigger this (I couldn’t find any great info on what exactly help_flags1 does). Is the behavior only hard-coded for the admin user?

Hey Svet,

Let me ask the backend squad about this. more soon!

1 Like

From Daniel and the squad:

This is the logic: grafana/LoginCtrl.tsx at main · grafana/grafana · GitHub for showing that screen. We don’t have a way of triggering it in the way Sven is asking about. It is just a simple if statement that checks if the password is admin. Sounds like a reasonable feature request though.

Also, see this related backend code for displaying that home page:

Helpflags stores if the user has dismissed the getting started panel on the home page: grafana/helpflags.go at main · grafana/grafana · GitHub

I like this idea!

Thanks Matt! Had a quick look - based on this it looks like implementing this systematically would probably involve changes to a few different components (e.g. a DB schema change to include an appropriate flag). For now I’m going with a different workflow that also does the job, so might let this one be.

I’m also conscious that the current focus is on enhancing Grafana’s integrations with third party auth services/methods, rather than necessarily building out a comprehensive internal auth engine (at least that’s my interpretation of e.g. Add configure the set password policy for users in grafana · Issue #12257 · grafana/grafana · GitHub)

1 Like