Commit 42a9b96e authored by Adam Hegyi's avatar Adam Hegyi

Add friendly message for unconfirmed users

parent c566de6b
---
title: Provide better git error message when the user is unconfirmed
merge_request: 37944
author:
type: fixed
......@@ -17,6 +17,10 @@ module Gitlab
when :deactivated
"Your account has been deactivated by your administrator. "\
"Please log back in from a web browser to reactivate your account at #{Gitlab.config.gitlab.url}"
when :unconfirmed
"Your primary email address is not confirmed. "\
"Please check your inbox for the confirmation instructions. "\
"In case the link is expired, you can request a new confirmation email at #{Rails.application.routes.url_helpers.new_user_confirmation_url}"
else
"Your account has been blocked."
end
......@@ -31,6 +35,8 @@ module Gitlab
:terms_not_accepted
elsif @user.deactivated?
:deactivated
elsif !@user.confirmed?
:unconfirmed
else
:blocked
end
......
......@@ -41,5 +41,13 @@ RSpec.describe Gitlab::Auth::UserAccessDeniedReason do
it { is_expected.to eq "Your account has been deactivated by your administrator. Please log back in from a web browser to reactivate your account at #{Gitlab.config.gitlab.url}" }
end
context 'when the user is unconfirmed' do
before do
user.update!(confirmed_at: nil)
end
it { is_expected.to match /Your primary email address is not confirmed/ }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment