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 @@ +

Public Key

+

All notification emails, including password resets, will be encrypted with this key if you supply it. Do not lose your private key, otherwise you won't be able to easily recover your account.

+ <%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----" %>

<%= f.submit "Save changes", class: "btn blue left" %>

-<% 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