diff options
author | Azul <azul@leap.se> | 2014-05-19 15:07:02 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2014-05-19 15:21:42 +0200 |
commit | 3a84578cf33685800c9216cfb4da12ea1fb0032f (patch) | |
tree | b2f3f2dcd5da823f371f0cc2e2deb3159de6a3c8 /app/controllers | |
parent | e8ba98df64cb537e85de8624c0ebb08c4135ccca (diff) |
store fingerprints with timestamp
Only storing the date as that should suffice for normal expiry and is less useful for identifying users by timestamps
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/v1/smtp_certs_controller.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/app/controllers/v1/smtp_certs_controller.rb b/app/controllers/v1/smtp_certs_controller.rb index 533a19a..fcc00b8 100644 --- a/app/controllers/v1/smtp_certs_controller.rb +++ b/app/controllers/v1/smtp_certs_controller.rb @@ -2,22 +2,36 @@ class V1::SmtpCertsController < ApplicationController before_filter :require_login before_filter :require_email_account + before_filter :fetch_identity # GET /1/smtp_cert def show @cert = ClientCertificate.new prefix: current_user.email_address - current_user.identity.cert_fingerprints << @cert.fingerprint - current_user.identity.save + @identity.register_cert(@cert) + @identity.save render text: @cert.to_s, content_type: 'text/plain' end protected + # + # Filters + # + def require_email_account access_denied unless service_level.provides? 'email' end + def fetch_identity + @identity = current_user.identity + end + + # + # Helper methods + # + def service_level current_user.effective_service_level end + end |