summaryrefslogtreecommitdiff
path: root/app/controllers/keys_controller.rb
blob: fb28901cf458758d49cbc01d9d88764125654f60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class KeysController < ApplicationController

  #
  # Render the user's key as plain text, without a layout.
  #
  # We will show blank page if user doesn't have key (which shouldn't generally occur)
  # and a 404 error if user doesn't exist
  #
  def show
    user = User.find_by_login(params[:login])
    if user
      render text: user.public_key, content_type: 'text/text'
    else
      raise ActionController::RoutingError.new('Not Found')
    end
  end

end