Class: Gitlab::Auth::UserAccessDeniedReason

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/auth/user_access_denied_reason.rb

Instance Method Summary collapse

Constructor Details

#initialize(user) ⇒ UserAccessDeniedReason

Returns a new instance of UserAccessDeniedReason.


6
7
8
# File 'lib/gitlab/auth/user_access_denied_reason.rb', line 6

def initialize(user)
  @user = user
end

Instance Method Details

#rejection_messageObject


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gitlab/auth/user_access_denied_reason.rb', line 10

def rejection_message
  case rejection_type
  when :internal
    "This action cannot be performed by internal users"
  when :terms_not_accepted
    "You (#{@user.to_reference}) must accept the Terms of Service in order to perform this action. "\
    "Please access GitLab from a web browser to accept these terms."
  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
end