]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Update to iD v2.19.3
[rails.git] / app / models / user.rb
index 65c70d2c7a4f8e097ae1277a1e4835a8ab032d1c..7e1f1c6d63f9fdc14c9e4d13e1f6cb2670ea669d 100644 (file)
@@ -44,6 +44,7 @@
 #
 
 class User < ApplicationRecord
+  require "digest"
   require "xml/libxml"
 
   has_many :traces, -> { where(:visible => true) }
@@ -306,6 +307,13 @@ class User < ApplicationRecord
     ClientApplication.find_by(:key => application_key).access_token_for_user(self)
   end
 
+  def fingerprint
+    digest = Digest::SHA256.new
+    digest.update(email)
+    digest.update(pass_crypt)
+    digest.hexdigest
+  end
+
   private
 
   def set_defaults