Skip to content

Commit 88aa54f

Browse files
committed
implement basic auth
1 parent 8d0c077 commit 88aa54f

File tree

82 files changed

+327
-72
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+327
-72
lines changed
Lines changed: 75 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,78 @@
11
/*
2-
* This is a manifest file that'll be compiled into application.css, which will include all the files
3-
* listed below.
4-
*
5-
* Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6-
* vendor/assets/stylesheets directory can be referenced here using a relative path.
7-
*
8-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
9-
* compiled file so the styles you add here take precedence over styles defined in any other CSS
10-
* files in this directory. Styles in this file should be added after the last require_* statement.
11-
* It is generally better to create a new file per style scope.
12-
*
13-
*= require_tree .
142
*= require_self
3+
*= require_tree .
154
*/
5+
6+
body {
7+
margin: 0;
8+
padding: 0;
9+
height: 100dvh;
10+
font-family: Arial, Helvetica, sans-serif;
11+
}
12+
13+
#navbar-container {
14+
border-bottom: 1px solid #eee;
15+
}
16+
17+
#navbar {
18+
display: flex;
19+
justify-content: space-between;
20+
width: 70%;
21+
margin: 0 auto;
22+
padding: 10px;
23+
font-size: 20px;
24+
}
25+
26+
#navbar-title {
27+
font-weight: 600;
28+
}
29+
30+
#navbar-items {
31+
display: flex;
32+
gap: 15px;
33+
}
34+
35+
36+
/* Login page */
37+
#login-container {
38+
height: 100dvh;
39+
display: flex;
40+
flex-direction: column;
41+
align-items: center;
42+
}
43+
44+
#login-inputs {
45+
display: flex;
46+
align-items: center;
47+
flex-direction: column;
48+
gap: 15px;
49+
}
50+
51+
#login-container .input-div input {
52+
box-sizing: border-box;
53+
width: 100%;
54+
border: 1px solid gray;
55+
padding: 7px 10px;
56+
border-radius: 6px;
57+
}
58+
59+
#login-button {
60+
margin-top: 10px;
61+
width: 150px;
62+
cursor: pointer;
63+
background-color: #1877f2;
64+
color: white;
65+
font-weight: 600;
66+
font-size: 18px;
67+
padding: 7px 0px;
68+
border: none;
69+
border-radius: 6px;
70+
}
71+
72+
#login-button:hover {
73+
background-color: #4267b2;
74+
}
75+
76+
#login-button:active {
77+
background-color: #264177;
78+
}

app/controllers/admin/team_controller.rb

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Admin::TeamsController < ApplicationController
2+
end

app/controllers/admin/user_controller.rb

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Admin::UsersController < ApplicationController
2+
3+
def index
4+
@users = User.all
5+
end
6+
end
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
class ApplicationController < ActionController::Base
22
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
3-
allow_browser versions: :modern
3+
# allow_browser versions: :modern
4+
5+
helper_method :current_user
6+
7+
def current_user
8+
@current_user ||= session[:user_id] && User.find_by(id: session[:user_id])
9+
end
10+
11+
before_action :require_login
12+
13+
private
14+
15+
def require_login
16+
unless logged_in?
17+
redirect_to login_path
18+
end
19+
end
20+
21+
def logged_in?
22+
!!current_user
23+
end
424
end

app/controllers/bike_controller.rb

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class BikesController < ApplicationController
2+
end

app/controllers/manage/team_controller.rb

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class Manage::TeamsController < ApplicationController
2+
end

0 commit comments

Comments
 (0)