Add authentication via devise

Signed-off-by: Tobias Eidelpes <tobias@eidelpes.info>
This commit is contained in:
2020-04-14 13:44:45 +02:00
parent 6014c64e64
commit 2f85af35cb
13 changed files with 501 additions and 12 deletions
+15 -6
View File
@@ -35,14 +35,13 @@ nav {
background-color: #3F51B5;
width: 100%;
display: grid;
grid-template-columns: 1fr auto 1fr;
box-shadow: 0 16px 24px 2px rgba(0,0,0,0.14), 0 6px 30px 5px rgba(0,0,0,0.12), 0 8px 10px -5px rgba(0,0,0,0.20);
grid-template-columns: max-content max-content auto;
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.20);
}
nav a {
color: white;
text-decoration: none;
text-transform: uppercase;
font-family: Helvetica, sans-serif;
font-size: 18px;
transition: .3s all ease-in-out;
@@ -66,13 +65,14 @@ nav a:hover {
display: inline-block;
grid-column: 1;
align-self: center;
margin-left: 1rem;
padding: 1rem;
}
.left-menu {
display: none;
grid-column: 1;
align-self: center;
text-transform: uppercase;
}
.left-menu a {
@@ -83,20 +83,29 @@ nav a:hover {
}
.right-menu {
display: inline-block;
grid-column: 3;
text-align: right;
font-size: 12px;
align-self: center;
}
.right-menu a {
padding: 18px 1rem 17px 1rem;
padding: 1.4rem 1rem 1.35rem 1rem;
font-size: 16px;
}
.logo {
grid-column: 2;
padding: 1rem;
padding: 1rem 1rem 1rem 0;
font-family: Helvetica, sans-serif;
font-size: 18px;
font-weight: 800;
align-self: center;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.logo:hover {
background-color: transparent;
}
+6
View File
@@ -0,0 +1,6 @@
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:rememberable, :validatable
end
+14 -6
View File
@@ -18,6 +18,7 @@
<label for="nav-toggle" class="burger-menu">
<%= show_svg('menu-white-24dp.svg') %>
</label>
<a href="#" class="logo">tiss2go</a>
<div class="left-menu">
<%= link_to 'Home', root_path %>
<%= link_to 'People', people_index_path %>
@@ -25,16 +26,23 @@
<%= link_to 'Projects', projects_index_path %>
<%= link_to 'Theses', theses_index_path %>
</div>
<a href="#" class="logo">tiss2go</a>
<div class="right-menu">
<!-- TODO: Change root_path to login/register page -->
<%= link_to 'Logout', root_path %>
<% if user_signed_in? %>
<%= link_to 'Edit profile', edit_user_registration_path %><!--
--><%= link_to "Logout", destroy_user_session_path, method: :delete %>
<% else %>
<%= link_to "Sign up", new_user_registration_path %><!--
--><%= link_to "Login", new_user_session_path %>
<% end %>
</div>
</nav>
<main>
<%= yield %>
</main>
<main>
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
</main>
</body>
</html>