From 417818997fca057635793cdf60a3e1bfa6716e35 Mon Sep 17 00:00:00 2001 From: Thais Siqueira Date: Fri, 10 Mar 2017 11:28:39 -0300 Subject: Adds recovery code to user account Related with https://github.com/pixelated/pixelated-user-agent/issues/924 With @aarni --- app/models/account.rb | 3 +++ app/models/user.rb | 2 ++ 2 files changed, 5 insertions(+) (limited to 'app/models') diff --git a/app/models/account.rb b/app/models/account.rb index d722caa..0731cac 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -62,6 +62,9 @@ class Account update_login(attrs[:login]) @user.update_attributes attrs.slice(:password_verifier, :password_salt) end + if attrs[:recovery_code_verifier].present? + @user.update_attributes attrs.slice(:recovery_code_verifier, :recovery_code_salt) + end # TODO: move into identity controller key = update_pgp_key(attrs[:public_key]) @user.errors.set :public_key, key.errors.full_messages diff --git a/app/models/user.rb b/app/models/user.rb index 259778b..215a3b0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -8,6 +8,8 @@ class User < CouchRest::Model::Base property :login, String, :accessible => true property :password_verifier, String, :accessible => true property :password_salt, String, :accessible => true + property :recovery_code_verifier, String, :accessible => true + property :recovery_code_salt, String, :accessible => true property :contact_email, String, :accessible => true property :contact_email_key, String, :accessible => true property :invite_code, String, :accessible => true -- cgit v1.2.3