Files
ubicloud/views/account/submenu.erb
Jeremy Evans db0df0ff6c Do not show Login Methods, Change Password, or Change Email for locked domains
Locked domains are not allowed to change any of these things, so
it is best not to display them.

Previously, the account submenu view handled a fourth argument for
whether the tab is active.  This behavior dates back to
842a476f54, when a fourth argument
was never passed. A fourth argument was eventually passed in
b1c0a2ede7, but it hasn't been needed
since a4a563b49b, when the /account
path was redirected to /account/multifactor-manage.

This changes the fourth argument to be a flag, which if set, does
not display the tab.
2025-07-16 08:06:32 +09:00

37 lines
1.7 KiB
Plaintext

<aside class="py-6 lg:col-span-4 xl:col-span-3 2xl:col-span-2">
<nav class="space-y-1">
<% disallow_login_methods = rodauth.locked_domain_for(current_account.email)
[
["Multifactor Auth", "/account/multifactor-manage", "hero-lock-closed"],
["Login Methods", "/account/login-method", "hero-finger-print", disallow_login_methods],
["#{rodauth.has_password? ? "Change" : "Create"} Password", "/account/change-password", "hero-key", disallow_login_methods],
["Change Email", "/account/change-login", "hero-envelope", disallow_login_methods],
["Close Account", "/account/close-account", "hero-x-circle"]
].each do |label, url, icon, disallowed| %>
<% next if disallowed %>
<% if request.path == url %>
<a
href="<%= url %>"
class="border-orange-600 bg-orange-50 text-orange-600 hover:bg-orange-50 hover:text-orange-700 group flex items-center border-l-4 px-3 py-2 text-sm font-medium"
aria-current="page"
>
<%== part(
"components/icon",
name: icon,
classes: "text-orange-600 group-hover:text-orange-600 -ml-1 mr-3 h-6 w-6 flex-shrink-0"
) %>
<span class="truncate"><%= label %></span>
</a>
<% else %>
<a
href="<%= url %>"
class="border-transparent text-gray-900 hover:bg-gray-50 hover:text-gray-900 group flex items-center border-l-4 px-3 py-2 text-sm font-medium"
>
<%== part("components/icon", name: icon, classes: "text-gray-400 group-hover:text-gray-500 -ml-1 mr-3 h-6 w-6 flex-shrink-0") %>
<span class="truncate"><%= label %></span>
</a>
<% end %>
<% end %>
</nav>
</aside>