summaryrefslogtreecommitdiff
path: root/users/app
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-12-06 15:53:45 -0800
committerelijah <elijah@riseup.net>2013-12-06 15:53:45 -0800
commite7e5dac36127a36cac9ed35054767d04b2e5ae17 (patch)
treefd66a4eefd7678a94668e7a80095372522677e01 /users/app
parent8dd9505cfa52796d8c4aad8a8ad44e4a5e4319cb (diff)
parenta013b03b0b715ec1209d2812da52ff5f0831c833 (diff)
Merge branch 'plaintextkey' into develop
Diffstat (limited to 'users/app')
-rw-r--r--users/app/controllers/keys_controller.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/users/app/controllers/keys_controller.rb b/users/app/controllers/keys_controller.rb
index 949f2c0..fb28901 100644
--- a/users/app/controllers/keys_controller.rb
+++ b/users/app/controllers/keys_controller.rb
@@ -1,12 +1,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])
- # layout won't be included if we render text
- # 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
- user ? (render text: user.public_key) : (raise ActionController::RoutingError.new('Not Found'))
-
+ if user
+ render text: user.public_key, content_type: 'text/text'
+ else
+ raise ActionController::RoutingError.new('Not Found')
+ end
end
end