From 44839b08ae1ad1f5c2e837c5d6130496da287cce Mon Sep 17 00:00:00 2001 From: jomo Date: Sun, 12 Jun 2016 00:44:39 +0200 Subject: [PATCH 1/3] fix syntax error when deleting invalid role from POST params --- app/controllers/users_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ea56ebf..ae9424e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -147,11 +147,11 @@ class UsersController < ApplicationController end if userdata[:role] role = Role.get(userdata[:role]) - if role <= current_user.role + if role && role <= current_user.role userdata[:role] = role else # don't change role - userdata.delete[:role] + userdata.delete(:role) end end if @user.youtube != userdata[:youtube] -- 2.52.0 From c8e964c23f542811ce60866fb629ef77a65c3899 Mon Sep 17 00:00:00 2001 From: jomo Date: Sun, 12 Jun 2016 00:54:28 +0200 Subject: [PATCH 2/3] clarify write-only notice --- app/views/forums/show.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 0612dad..60f3185 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -6,7 +6,13 @@ <% end %> <% if @forum.role_read && @forum.role_write && @forum.role_write < @forum.role_read %> -
This forum is write-only. You can only see your own posts.
+
+ <% if @forum.role_read > current_user.role %> + This forum is write-only. You can only see your own posts. + <% else %> + This forum is write-only for users ranked under <%= @forum.role_read %>. They can only see their own posts. + <% end %> +
<% end %>
-- 2.52.0 From db1c10eb9b89900db2e1f1c48a8d76cf669ab277 Mon Sep 17 00:00:00 2001 From: Jonas Folvik Date: Sun, 12 Jun 2016 20:36:53 +0200 Subject: [PATCH 3/3] An Option to resend the confirmation mail You should now be able to resend the confirmation mail with the click of a link that is next to the warning that the mail isn't confirmed. Resend the confirmation mail cleaning Just a way to re use the files and stuff we already have instead of the file I created even though I could use the register_mail we have. Change of route and link to button I changed the route from GET to POST because of security reasons, and changed the link_to to a button_to changed the notice I changed the notice so it said check for the mail instead of check for the link Changed notice and button Changed the notice to say "Check your inbox" instead of "Check your mail" also changed the way the class looks --- app/controllers/users_controller.rb | 8 +++++++- app/mailers/redstoner_mailer.rb | 2 +- app/views/users/show.html.erb | 3 ++- config/routes.rb | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ea56ebf..aec4c36 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -138,6 +138,12 @@ class UsersController < ApplicationController end end + def resend_mail + RedstonerMailer.register_mail(@user, false).deliver_now + flash[:notice] = "Check your inbox for the confirmation mail." + redirect_to users_path(@user) + end + def update if (mod? && current_user.role >= @user.role ) || (@user.is?(current_user) && confirmed?) if mod? @@ -344,4 +350,4 @@ class UsersController < ApplicationController 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 params.require(:user).permit(a) end -end \ No newline at end of file +end diff --git a/app/mailers/redstoner_mailer.rb b/app/mailers/redstoner_mailer.rb index 38e9956..1b387f8 100644 --- a/app/mailers/redstoner_mailer.rb +++ b/app/mailers/redstoner_mailer.rb @@ -44,4 +44,4 @@ class RedstonerMailer < ActionMailer::Base @user = user mail(to: @user.email, subject: "Email change on Redstoner.com") end -end \ No newline at end of file +end diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 56ece88..eabe78e 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -23,6 +23,7 @@ <% if !@user.confirmed? %> <% if @user.is?(current_user) %> Please confirm your email <%= @user.email %> ! + <%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn red" %> <% else %> This user hasn't confirmed their email yet! <% end %> @@ -107,4 +108,4 @@ <% else %> <%= render_md(@user.about).html_safe %> <% end %> -
\ No newline at end of file + diff --git a/config/routes.rb b/config/routes.rb index 1caa0ca..584c94f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,7 @@ Redstoner::Application.routes.draw do member do get 'confirm' get 'edit_login' + post 'resend_mail' get 'edit_notifications' put 'update_login' end @@ -51,4 +52,4 @@ Redstoner::Application.routes.draw do get '/dmca' => redirect('https://www.youtube.com/watch?v=oHg5SJYRHA0') root to: 'statics#index' -end \ No newline at end of file +end -- 2.52.0