summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Fick <logaldeveloper@protonmail.com>2017-10-12 20:46:23 -0400
committerLogan Fick <logaldeveloper@protonmail.com>2017-10-12 20:46:23 -0400
commit3e7a0e550fa3e7730bf0b2bb44a3d93a25307514 (patch)
tree0ea5faad580677be9b8706e9e3dac4a19955859b
parent611c52223a5d7ebea1dbe73d46b061229f6918e1 (diff)
Added ability to add public key to account.
-rw-r--r--app/controllers/users_controller.rb2
-rw-r--r--app/views/users/edit_notifications.html.erb5
-rw-r--r--db/migrate/20171013001146_add_public_key_to_users.rb5
3 files changed, 10 insertions, 2 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 5c55976..4890a98 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -352,7 +352,7 @@ class UsersController < ApplicationController
end
def user_params(add = [])
- a = [:ign, :email, :password, :password_confirmation, :mail_own_thread_reply, :mail_other_thread_reply, :mail_own_blogpost_comment, :mail_other_blogpost_comment, :mail_mention] + add
+ a = [:ign, :email, :password, :password_confirmation, :mail_own_thread_reply, :mail_other_thread_reply, :mail_own_blogpost_comment, :mail_other_blogpost_comment, :mail_mention, :public_key] + add
params.require(:user).permit(a)
end
end
diff --git a/app/views/users/edit_notifications.html.erb b/app/views/users/edit_notifications.html.erb
index 4e6de12..e0e8288 100644
--- a/app/views/users/edit_notifications.html.erb
+++ b/app/views/users/edit_notifications.html.erb
@@ -45,6 +45,9 @@
</tr>
</tbody>
</table>
+ <h3>Public Key</h1>
+ <p>All notification emails, including password resets, will be encrypted with this key if you supply it. <b>Do not lose your private key, otherwise you won't be able to easily recover your account.</b></p>
+ <%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----" %>
<p><%= f.submit "Save changes", class: "btn blue left" %></p>
<div class="clear"></div>
-<% end %> \ No newline at end of file
+<% end %>
diff --git a/db/migrate/20171013001146_add_public_key_to_users.rb b/db/migrate/20171013001146_add_public_key_to_users.rb
new file mode 100644
index 0000000..a03743c
--- /dev/null
+++ b/db/migrate/20171013001146_add_public_key_to_users.rb
@@ -0,0 +1,5 @@
+class AddPublicKeyToUsers < ActiveRecord::Migration
+ def change
+ add_column :users, :public_key, :text
+ end
+end