summaryrefslogtreecommitdiff
path: root/app/models/identity.rb
diff options
context:
space:
mode:
authorazul <azul@leap.se>2014-07-14 07:52:12 +0200
committerazul <azul@leap.se>2014-07-14 07:52:12 +0200
commit07b141f3d677e993f02380b455738b20b9f0fe42 (patch)
tree553111ac07f6100738f29ddc7165fa800852f224 /app/models/identity.rb
parent1c7308207a9ab46cfb60c72aceaee2b3c82281fe (diff)
parent3bbfdf29bbc40432c21e34fe84060cf9ae70273f (diff)
Merge pull request #175 from azul/feature/view-for-valid-certs
Feature/view for valid certs
Diffstat (limited to 'app/models/identity.rb')
-rw-r--r--app/models/identity.rb29
1 files changed, 4 insertions, 25 deletions
diff --git a/app/models/identity.rb b/app/models/identity.rb
index eb67b1b..9dc9c7a 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -18,32 +18,11 @@ class Identity < CouchRest::Model::Base
validate :destination_email
design do
+ own_path = Pathname.new(File.dirname(__FILE__))
+ load_views(own_path.join('..', 'designs', 'identity'), nil)
view :by_user_id
view :by_address_and_destination
view :by_address
- view :pgp_key_by_email,
- map: <<-EOJS
- function(doc) {
- if (doc.type != 'Identity') {
- return;
- }
- if (typeof doc.keys === "object") {
- emit(doc.address, doc.keys["pgp"]);
- }
- }
- EOJS
- view :disabled,
- map: <<-EOJS
- function(doc) {
- if (doc.type != 'Identity') {
- return;
- }
- if (typeof doc.user_id === "undefined") {
- emit(doc._id, 1);
- }
- }
- EOJS
-
end
def self.address_starts_with(query)
@@ -146,9 +125,9 @@ class Identity < CouchRest::Model::Base
end
def register_cert(cert)
- today = DateTime.now.to_date.to_s
+ expiry = cert.expiry.to_date.to_s
write_attribute 'cert_fingerprints',
- cert_fingerprints.merge(cert.fingerprint => today)
+ cert_fingerprints.merge(cert.fingerprint => expiry)
end
# for LoginFormatValidation