Mailinglist Archive: opensuse-buildservice (93 mails)

< Previous Next >
Re: [opensuse-buildservice] How to change a user's password in private OBS installation?
Hi all, hi David

On Thursday, July 18, 2019 5:06:51 PM CEST David Kang wrote:
On 7/17/19 11:47 AM, Stefan Botter wrote:
:
how do I - as admin - change a user's password in a private OBS
installation, e.g. with the builtin user management?
In previous versions something like
----
RAILS_ENV="production" /usr/bin/rails.ruby2.5-5.1.4 console
user = User.where(:login => '<loginname>').first
user.password = "<password>"
user.password_confirmation = "<password>"
user.save
----
worked. Now this still succeeds (no error messages), but the user
cannot login with the new password.

How can I change the password?

You can do it with:

user = User.where(:login => '<loginname>').first
user.password = "<password>"

user.save!

It did not work, but I found out, that the user still had the password
in the deprecated_password* fields set. The above procedure sets the
password in password_digest, but does not NULL the deprecated_password*
fields, and the latter seem to have precedence.
NULLing the old fields lets the user finally login.

Issue #7948 created.

Greetings,

Stefan
--
Stefan Botter zu Hause
Bremen
< Previous Next >
This Thread
References