Class: ProveKeybase::KeybaseBaseController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/prove_keybase/keybase_base_controller.rb,
lib/generators/prove_keybase/templates/base_controller.rb

Instance Method Summary collapse

Instance Method Details

#avatar_url_from_username(username) ⇒ Object



21
22
23
24
25
# File 'app/controllers/prove_keybase/keybase_base_controller.rb', line 21

def avatar_url_from_username(username)
  # if you override this method, please keep the behavior
  # of raising an exception when a user does not exist.
  User.find_by!(username: username).avatar_url || 'https://example.com/default_avatar.jpg'
end

#handle_proof_failedObject



16
17
18
19
# File 'app/controllers/prove_keybase/keybase_base_controller.rb', line 16

def handle_proof_failed
  flash[:alert] = 'proof failed. please start again from keybase.'
  redirect_to new_proof_url(params: proof_params)
end

#user_is_logged_in!Object



6
7
8
# File 'app/controllers/prove_keybase/keybase_base_controller.rb', line 6

def user_is_logged_in!
   unless current_user
end

#user_proving_own_account!Object



10
11
12
13
14
# File 'app/controllers/prove_keybase/keybase_base_controller.rb', line 10

def user_proving_own_account!
  unless current_user.username.casecmp(@proving_username).zero?
    handle_wrong_logged_in_user(current_user.username, @proving_username)
  end
end