summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Fick <logaldeveloper@protonmail.com>2017-11-10 15:17:22 -0500
committerLogan Fick <logaldeveloper@protonmail.com>2017-11-10 15:17:22 -0500
commite7cd6d6e99578feecf1162853a2601d1cf61f833 (patch)
tree60c698ed5deda5af2d1c1b060db9020d5cf9a626
parentbadb94ff074cfd63e078d9f4d0f7198b8e0895a5 (diff)
Made the website settings page not editable if user's email is not confirmed.
-rw-r--r--app/views/users/edit_website_settings.html.erb20
1 files 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
<h1>Edit Website Settings</h1>
@@ -10,25 +16,31 @@
<tr>
<td>Header moves with scrolling (Experimental - do not report bugs)</td>
<td>
- <%= f.check_box :header_scroll %>
+ <%= f.check_box :header_scroll, disabled: !can_edit? %>
</td>
</tr>
<tr>
<td>Show exact UTC times</td>
<td>
- <%= f.check_box :utc_time %>
+ <%= f.check_box :utc_time, disabled: !can_edit? %>
</td>
</tr>
<tr>
<td>Dark theme*</td>
<td>
- <%= f.check_box :dark %>
+ <%= f.check_box :dark, disabled: !can_edit? %>
</td>
</tr>
</tbody>
</table>
- <p><%= f.submit "Save changes", class: "btn blue left" %></p>
+ <p><%= f.submit "Save changes", class: "btn blue left", disabled: !can_edit? %></p>
<div class="clear"></div>
+
+ <% if !@user.is?(current_user) && !current_user.confirmed? %>
+ <span class='red-alert'>You must confirm your own email before you can edit other user's website settings.</span>
+ <% elsif !@user.confirmed? && @user.is?(current_user) %>
+ <span class='red-alert'>You need to confirm your email before you can edit your website settings.</span>
+ <% end %>
<% end %>
<br><br><br>
*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â„¢.