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

  #
  # Render the user's key as plain text, without a layout.
  #
  # 404 error if user doesn't exist
  #
  # blank result if user doesn't have key (which shouldn't generally occur)
  #
  def show
    user = User.find_by_login(params[:login])
    if user
      render text: user.public_key, content_type: 'text/text'
    else
      head 404
    end
  end

end