From e7cd6d6e99578feecf1162853a2601d1cf61f833 Mon Sep 17 00:00:00 2001 From: Logan Fick Date: Fri, 10 Nov 2017 15:17:22 -0500 Subject: Made the website settings page not editable if user's email is not confirmed. --- app/views/users/edit_website_settings.html.erb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/views/users/edit_website_settings.html.erb b/app/views/users/edit_website_settings.html.erb index 2fdeffb..7d6a654 100644 --- a/app/views/users/edit_website_settings.html.erb +++ b/app/views/users/edit_website_settings.html.erb @@ -1,5 +1,11 @@ <% title "Edit Website Settings: #{@user.name}" %> +<% + def can_edit? + (@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?) + end +%> + <%= link_to @user.name, @user %> → Edit Website Settings

Edit Website Settings

@@ -10,25 +16,31 @@ Header moves with scrolling (Experimental - do not report bugs) - <%= f.check_box :header_scroll %> + <%= f.check_box :header_scroll, disabled: !can_edit? %> Show exact UTC times - <%= f.check_box :utc_time %> + <%= f.check_box :utc_time, disabled: !can_edit? %> Dark theme* - <%= f.check_box :dark %> + <%= f.check_box :dark, disabled: !can_edit? %> -

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

+

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

+ + <% if !@user.is?(current_user) && !current_user.confirmed? %> + You must confirm your own email before you can edit other user's website settings. + <% elsif !@user.confirmed? && @user.is?(current_user) %> + You need to confirm your email before you can edit your website settings. + <% end %> <% end %>


*Warning: If as a result to enabling this style your eyes get infected with a severe case of eye cancer, we are not reliable for any damage. Please contact your doctor in advance to ensure that in case of infection you will be treated accordingly. Quality theme brought to you by Redemptâ„¢. -- cgit v1.2.3