Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change email address via gitlab-rails (avoid email reconfirmation)

Tags:

gitlab

While I am waiting for a merge request to be introduced to Gitlab to avoid this problem I need a workaround to edit an user's email address via the gitlab-rails console.

Using this:

user = User.find_by(name: 'test')
user.email = '[email protected]'
user.save

allows to edit the user but I am asked to confirm the new email before it is applied. Any idea?

like image 483
djuarezg Avatar asked Sep 06 '25 20:09

djuarezg


1 Answers

I found it afterwards, so in case someone has the same problem:

gitlab-rails runner '
                      user = User.find_by(name: 'test')
                      user.email = '[email protected]'
                      user.skip_reconfirmation!
                      user.save
                    '

EDIT: This used to work in old version, but is no longer required as I contributed to add a skip confirmation when using the Users API: https://docs.gitlab.com/ee/api/users.html#add-email-for-user

like image 105
djuarezg Avatar answered Sep 11 '25 02:09

djuarezg