An unofficial, mostly Bitwarden-compatible API server written in Ruby (Sinatra and ActiveRecord)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Cipher: add password history tracking

This is just a simple array that the Bitwarden clients manage for
us, so just pass it through to the db.

Closes #89

+14
+5
db/migrate/20190526014920_password_history.rb
··· 1 + class PasswordHistory < ActiveRecord::Migration[5.1] 2 + def change 3 + add_column :ciphers, :passwordhistory, :binary 4 + end 5 + end
+9
lib/cipher.rb
··· 29 29 serialize :securenote, JSON 30 30 serialize :card, JSON 31 31 serialize :identity, JSON 32 + serialize :passwordhistory, JSON 32 33 33 34 TYPE_LOGIN = 1 34 35 TYPE_NOTE = 2 ··· 99 100 "Card" => self.card, 100 101 "Identity" => self.identity, 101 102 "SecureNote" => self.securenote, 103 + "PasswordHistory" => self.passwordhistory, 102 104 } 103 105 end 104 106 ··· 125 127 end 126 128 127 129 self.login = tlogin 130 + 131 + if params[:passwordhistory].present? 132 + self.passwordhistory = params[:passwordhistory]. 133 + map{|ph| ph.ucfirst_hash } 134 + else 135 + self.passwordhistory = nil 136 + end 128 137 129 138 when TYPE_NOTE 130 139 self.securenote = params[:securenote].ucfirst_hash