diff options
author | azul <azul@riseup.net> | 2013-02-26 07:25:12 -0800 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-02-26 07:25:12 -0800 |
commit | 5dbbf733a6abe809a38667e8b3277fd06db24788 (patch) | |
tree | 14f60e6facd88dc5d218aec14175a59fdf5834ad /certs/app/controllers/certs_controller.rb | |
parent | 1023cac35016bb1a89864d10ac89acabe86cf227 (diff) | |
parent | 2eafc17ea68e75e6b040b6c6677e5eebd3371f0e (diff) |
Merge pull request #27 from leapcode/feature/free-certs
Enable free certs
Diffstat (limited to 'certs/app/controllers/certs_controller.rb')
-rw-r--r-- | certs/app/controllers/certs_controller.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/certs/app/controllers/certs_controller.rb b/certs/app/controllers/certs_controller.rb index 6db270c..977e03e 100644 --- a/certs/app/controllers/certs_controller.rb +++ b/certs/app/controllers/certs_controller.rb @@ -1,11 +1,16 @@ class CertsController < ApplicationController - before_filter :authorize + before_filter :logged_in_or_free_certs # GET /cert def show - @cert = ClientCertificate.new - render :text => @cert.key + @cert.cert, :content_type => 'text/plain' + @cert = ClientCertificate.new(free: !logged_in?) + render text: @cert.to_s, content_type: 'text/plain' end + protected + + def logged_in_or_free_certs + authorize unless APP_CONFIG[:free_certs_enabled] + end end |