Small nav updates and fixes
This commit is contained in:
@@ -14,7 +14,7 @@ class User < ApplicationRecord
|
|||||||
|
|
||||||
# validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
# validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
||||||
validates :email, presence: true, uniqueness: true,
|
validates :email, presence: true, uniqueness: true,
|
||||||
format: { with: /\b[A-Z0-9._%a-z\-]+@(student\.|)hs\-rm\.de\z/, message: "must be a student.hs-rm.de or hs-rm.de account" }
|
format: { with: /\b[A-Z0-9._%a-z\-]+@(student\.|)hs\-rm\.de\z/, message: "must be a student.hs-rm.de or hs-rm.de email" }
|
||||||
|
|
||||||
validates :password, allow_nil: true, length: { minimum: 12 }
|
validates :password, allow_nil: true, length: { minimum: 12 }
|
||||||
validates :password, not_pwned: { message: "might easily be guessed" }
|
validates :password, not_pwned: { message: "might easily be guessed" }
|
||||||
|
|||||||
@@ -1,23 +1,15 @@
|
|||||||
<p style="color: green"><%= notice %></p>
|
<p style="color: green"><%= notice %></p>
|
||||||
|
|
||||||
<p>Signed as <%= Current.user.email %></p>
|
<p>Signed as <%= Current.user.email %></p>
|
||||||
|
|
||||||
<h2>Login and verification</h2>
|
<h2>Login and verification</h2>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= link_to "Change password", edit_password_path %>
|
<%= link_to "Change password", edit_password_path %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= link_to "Change email address", edit_identity_email_path %>
|
<%= link_to "Change email address", edit_identity_email_path %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2>Access history</h2>
|
<h2>Access history</h2>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= link_to "Devices & Sessions", sessions_path %>
|
<%= link_to "Devices & Sessions", sessions_path %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<%= button_to "Log out", Current.session, method: :delete %>
|
<%= button_to "Log out", Current.session, method: :delete %>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<header class="container flex items-center justify-between px-4 py-6 mx-auto border-b-2 border-gray-300">
|
<header class="container flex items-center justify-between px-4 py-6 mx-auto border-b-2 border-gray-300">
|
||||||
<a href="/" class="text-4xl font-bold text-hsrm-gray">Plottservice Fachbereich AB</a>
|
<a href="/" class="text-4xl font-bold text-hsrm-gray">Plottservice Fachbereich AB</a>
|
||||||
<% if user_signed_in? && current_user&.admin? || current_user&.operator? %>
|
<% if user_signed_in? && current_user.admin? || current_user.operator? %>
|
||||||
<nav>
|
<nav>
|
||||||
<ul class="flex justify-center font-semibold items-color">
|
<ul class="flex justify-center font-semibold items-color">
|
||||||
<li class="relative">
|
<li class="relative">
|
||||||
<button class="px-4 py-2 cursor-default hover:text-hsrm-red">
|
<button class="px-4 py-2 cursor-default hover:text-hsrm-red">
|
||||||
Admin
|
<%= link_to_if current_user.admin?, "Admin", admin_dashboard_path %>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="relative">
|
<li class="relative">
|
||||||
@@ -19,8 +19,11 @@
|
|||||||
<nav>
|
<nav>
|
||||||
<ul class="flex items-center">
|
<ul class="flex items-center">
|
||||||
<% if user_signed_in? %>
|
<% if user_signed_in? %>
|
||||||
<li><%= current_user.email %></li>
|
<li><%= button_to Current.session, method: :delete, class: "flex btn btn-primary" do %>
|
||||||
<li><%= button_to 'Abmelden', Current.session, method: :delete, class: "btn btn-primary" %></li>
|
<%= current_user.email %>
|
||||||
|
<%= icon "arrow-right-on-rectangle", class: "ml-2 size-6" %>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li><%= link_to 'Anmelden', sign_in_path, class: "btn btn-primary" %></li>
|
<li><%= link_to 'Anmelden', sign_in_path, class: "btn btn-primary" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ Rails.application.routes.draw do
|
|||||||
patch "cancel"
|
patch "cancel"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
namespace :admin do
|
||||||
|
resource :users
|
||||||
|
resource :jobs
|
||||||
|
resource :dashboard
|
||||||
|
end
|
||||||
namespace :operator do
|
namespace :operator do
|
||||||
resources :jobs do
|
resources :jobs do
|
||||||
member do
|
member do
|
||||||
|
|||||||
Reference in New Issue
Block a user