action_auth 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -8
- data/app/assets/stylesheets/action_auth/application.css +101 -15
- data/app/controllers/action_auth/identity/email_verifications_controller.rb +1 -0
- data/app/views/action_auth/identity/emails/edit.html.erb +23 -20
- data/app/views/action_auth/identity/password_resets/new.html.erb +10 -5
- data/app/views/action_auth/registrations/new.html.erb +11 -5
- data/app/views/action_auth/sessions/new.html.erb +8 -12
- data/app/views/layouts/action_auth/application.html.erb +4 -4
- data/lib/action_auth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 833b67b5320991ffda2c7a9bf6bc7e7b0c38d2cd725ffec5060db45bd64ab247
|
4
|
+
data.tar.gz: f9f2e1c7dc63d26595d2188c9b7c7ccdcbdd93d0debd90c96450dd8c3246e7a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a141534bd16cdc1d343f36903fb6b08585740dee6f00a6525ada9fa7cba3abb67e88e3073025de74bd57125ec41b138ef44ee643ef0ce1a223ef0553b641e55f
|
7
|
+
data.tar.gz: eabbec0f09c5a2bcac0a4deaa858ce74917f5e03c059229ea4e22cc0b682c8c44e641a0c6f7dd8d732bb65002e8b7d658045008c8cee73fe940e8dabbb91685e
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# ActionAuth
|
2
|
-
|
2
|
+
ActionAuth is a Rails engine that provides a simple authentication system for your Rails application.
|
3
|
+
It uses the latest methods for authentication and handling reset tokens from Rails 7.1.0.
|
4
|
+
It is designed to be simple and easy to use and allows you to focus on building your application.
|
5
|
+
The functionality of this gem relies on ActiveSupport::CurrentAttributes the methods are
|
6
|
+
designed to have a similar experience as Devise.
|
3
7
|
|
4
8
|
## Installation
|
5
9
|
Add this line to your application's Gemfile:
|
@@ -15,6 +19,18 @@ Modify config/routes.rb to include the following:
|
|
15
19
|
mount ActionAuth::Engine => 'action_auth'
|
16
20
|
```
|
17
21
|
|
22
|
+
In your view layout
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
<% if user_signed_in? %>
|
26
|
+
<li><%= link_to "Sessions", user_sessions_path %></li>
|
27
|
+
<li><%= button_to "Sign Out", user_session_path(current_session), method: :delete %></li>
|
28
|
+
<% else %>
|
29
|
+
<li><%= link_to "Sign In", new_user_session_path %></li>
|
30
|
+
<li><%= link_to "Sign Up", new_user_registration_path %></li>
|
31
|
+
<% end %>
|
32
|
+
```
|
33
|
+
|
18
34
|
## Usage
|
19
35
|
|
20
36
|
### Routes
|
@@ -22,18 +38,19 @@ mount ActionAuth::Engine => 'action_auth'
|
|
22
38
|
Within your application, you'll have access to these routes. They have been styled to be consistent with Devise.
|
23
39
|
|
24
40
|
Method Verb Params Description
|
25
|
-
user_sessions_path GET
|
26
|
-
user_session_path
|
27
|
-
new_user_session_path
|
28
|
-
new_user_registration_path GET
|
41
|
+
user_sessions_path GET Device session management
|
42
|
+
user_session_path DELETE [:id] Log Out
|
43
|
+
new_user_session_path GET Log in
|
44
|
+
new_user_registration_path GET Sign Up
|
45
|
+
edit_password_path GET Change Password
|
46
|
+
password_path PATCH Update Password
|
29
47
|
|
30
48
|
### Helper Methods
|
31
49
|
|
32
50
|
Method Description
|
33
|
-
current_user
|
51
|
+
current_user Returns the currently logged in user
|
34
52
|
user_signed_in? Returns true if the user is logged in
|
35
|
-
current_session
|
36
|
-
|
53
|
+
current_session Returns the current session
|
37
54
|
|
38
55
|
## License
|
39
56
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -1,15 +1,101 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
body {
|
2
|
+
box-sizing: border-box;
|
3
|
+
margin: 0;
|
4
|
+
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
5
|
+
font-size: 1rem;
|
6
|
+
font-weight: 400;
|
7
|
+
line-height: 1.5;
|
8
|
+
color: #212529;
|
9
|
+
text-align: left;
|
10
|
+
/* Assuming default alignment should be left */
|
11
|
+
-webkit-text-size-adjust: 100%;
|
12
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
13
|
+
margin-top: 25px;
|
14
|
+
background-color: rgb(248, 249, 250) !important;
|
15
|
+
}
|
16
|
+
|
17
|
+
.container {
|
18
|
+
-webkit-text-size-adjust: 100%;
|
19
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
20
|
+
box-sizing: border-box;
|
21
|
+
width: 400px;
|
22
|
+
padding-right: 12px;
|
23
|
+
padding-left: 12px;
|
24
|
+
margin-right: auto;
|
25
|
+
margin-left: auto;
|
26
|
+
max-width: 1140px;
|
27
|
+
border: solid 1px rgb(222, 226, 230) !important;
|
28
|
+
padding-bottom: 1rem !important;
|
29
|
+
background-color: rgb(255, 255, 255) !important;
|
30
|
+
}
|
31
|
+
|
32
|
+
input[type="text"],
|
33
|
+
input[type="email"],
|
34
|
+
input[type="password"] {
|
35
|
+
-webkit-text-size-adjust: 100%;
|
36
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
37
|
+
box-sizing: border-box;
|
38
|
+
margin: 0;
|
39
|
+
font-family: inherit;
|
40
|
+
display: block;
|
41
|
+
width: 100%;
|
42
|
+
padding: 0.375rem 0.75rem;
|
43
|
+
font-size: 1rem;
|
44
|
+
font-weight: 400;
|
45
|
+
line-height: 1.5;
|
46
|
+
color: #212529;
|
47
|
+
appearance: none;
|
48
|
+
background-color: #fff;
|
49
|
+
background-clip: padding-box;
|
50
|
+
border: 1px solid #dee2e6;
|
51
|
+
border-radius: 0.375rem;
|
52
|
+
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
53
|
+
}
|
54
|
+
|
55
|
+
.mb-3 {
|
56
|
+
margin-bottom: 1rem !important;
|
57
|
+
}
|
58
|
+
|
59
|
+
.btn {
|
60
|
+
padding: 0.375rem 0.75rem;
|
61
|
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
62
|
+
font-size: 1rem;
|
63
|
+
font-weight: 400;
|
64
|
+
line-height: 1.5;
|
65
|
+
color: #333;
|
66
|
+
text-align: center;
|
67
|
+
text-decoration: none;
|
68
|
+
vertical-align: middle;
|
69
|
+
user-select: none;
|
70
|
+
border: 1px solid #007bff;
|
71
|
+
border-radius: 0.25rem;
|
72
|
+
background-color: #007bff;
|
73
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
|
74
|
+
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
75
|
+
cursor: pointer;
|
76
|
+
}
|
77
|
+
|
78
|
+
.btn:hover {
|
79
|
+
color: #fff;
|
80
|
+
background-color: #0056b3;
|
81
|
+
border-color: #004085;
|
82
|
+
}
|
83
|
+
|
84
|
+
.btn:focus {
|
85
|
+
outline: 0;
|
86
|
+
box-shadow: 0 0 0 0.25rem rgba(49, 132, 253, .5);
|
87
|
+
}
|
88
|
+
|
89
|
+
.btn:disabled {
|
90
|
+
color: #fff;
|
91
|
+
background-color: #007bff;
|
92
|
+
border-color: #007bff;
|
93
|
+
opacity: 0.65;
|
94
|
+
pointer-events: none;
|
95
|
+
}
|
96
|
+
|
97
|
+
.btn-primary {
|
98
|
+
color: #fff;
|
99
|
+
background-color: #007bff;
|
100
|
+
border-color: #007bff;
|
101
|
+
}
|
@@ -1,18 +1,21 @@
|
|
1
|
-
<p style="color: red"><%= alert %></p>
|
2
1
|
|
3
|
-
<% if ActionAuth::Current.user.verified? %>
|
4
|
-
|
2
|
+
<% if user_signed_in? && ActionAuth::Current.user.verified? %>
|
3
|
+
<% header_text = "Change Your Email" %>
|
4
|
+
<% label_text = "New email" %>
|
5
|
+
<% button_text = "Save changes" %>
|
5
6
|
<% else %>
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
<% header_text = "Verify Your Email" %>
|
8
|
+
<% label_text = "Email" %>
|
9
|
+
<% button_text = "Send verification email" %>
|
9
10
|
<% end %>
|
11
|
+
<h1><%= header_text %></h1>
|
12
|
+
|
13
|
+
<p style="color: red"><%= alert %></p>
|
10
14
|
|
11
15
|
<%= form_with(url: identity_email_path, method: :patch) do |form| %>
|
12
|
-
<% if @user
|
16
|
+
<% if @user&.errors&.any? %>
|
13
17
|
<div style="color: red">
|
14
18
|
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
15
|
-
|
16
19
|
<ul>
|
17
20
|
<% @user.errors.each do |error| %>
|
18
21
|
<li><%= error.full_message %></li>
|
@@ -21,23 +24,23 @@
|
|
21
24
|
</div>
|
22
25
|
<% end %>
|
23
26
|
|
24
|
-
<div>
|
25
|
-
<%= form.label :email,
|
27
|
+
<div class="mb-3">
|
28
|
+
<%= form.label :email, label_text, style: "display: block" %>
|
26
29
|
<%= form.email_field :email, required: true, autofocus: true %>
|
27
30
|
</div>
|
28
31
|
|
29
|
-
<div>
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
<div class="mb-3">
|
33
|
+
<% if user_signed_in? && ActionAuth::Current.user.verified? %>
|
34
|
+
<%= form.submit button_text, class: "btn btn-primary" %>
|
35
|
+
<% else %>
|
36
|
+
<%= button_to button_text, identity_email_verification_path, class: "btn btn-primary" %>
|
37
|
+
<% end %>
|
33
38
|
|
34
|
-
<div>
|
35
|
-
<%= form.submit "Save changes" %>
|
36
39
|
</div>
|
37
40
|
<% end %>
|
38
41
|
|
39
|
-
<
|
40
|
-
|
41
|
-
|
42
|
-
<%= link_to "
|
42
|
+
<div class="mb-3">
|
43
|
+
<%= link_to "Sign In", sign_in_path %> |
|
44
|
+
<%= link_to "Sign Up", sign_up_path %> |
|
45
|
+
<%= link_to "Reset Password", new_identity_password_reset_path %>
|
43
46
|
</div>
|
@@ -1,14 +1,19 @@
|
|
1
|
-
<p style="color: red"><%= alert %></p>
|
2
|
-
|
3
1
|
<h1>Forgot your password?</h1>
|
2
|
+
<p style="color: red"><%= alert %></p>
|
4
3
|
|
5
4
|
<%= form_with(url: identity_password_reset_path) do |form| %>
|
6
|
-
<div>
|
5
|
+
<div class="mb-3">
|
7
6
|
<%= form.label :email, style: "display: block" %>
|
8
7
|
<%= form.email_field :email, required: true, autofocus: true %>
|
9
8
|
</div>
|
10
9
|
|
11
|
-
<div>
|
12
|
-
<%= form.submit "Send password reset email" %>
|
10
|
+
<div class="mb-3">
|
11
|
+
<%= form.submit "Send password reset email", class: "btn btn-primary" %>
|
13
12
|
</div>
|
14
13
|
<% end %>
|
14
|
+
|
15
|
+
<div class="mb-3">
|
16
|
+
<%= link_to "Sign In", sign_in_path %> |
|
17
|
+
<%= link_to "Sign Up", sign_up_path %> |
|
18
|
+
<%= link_to "Verify Email", identity_email_verification_path %>
|
19
|
+
</div>
|
@@ -13,23 +13,29 @@
|
|
13
13
|
</div>
|
14
14
|
<% end %>
|
15
15
|
|
16
|
-
<div>
|
16
|
+
<div class="mb-3">
|
17
17
|
<%= form.label :email, style: "display: block" %>
|
18
18
|
<%= form.email_field :email, value: @user.email, required: true, autofocus: true, autocomplete: "email" %>
|
19
19
|
</div>
|
20
20
|
|
21
|
-
<div>
|
21
|
+
<div class="mb-3">
|
22
22
|
<%= form.label :password, style: "display: block" %>
|
23
23
|
<%= form.password_field :password, required: true, autocomplete: "new-password" %>
|
24
24
|
<div>12 characters minimum.</div>
|
25
25
|
</div>
|
26
26
|
|
27
|
-
<div>
|
27
|
+
<div class="mb-3">
|
28
28
|
<%= form.label :password_confirmation, style: "display: block" %>
|
29
29
|
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password" %>
|
30
30
|
</div>
|
31
31
|
|
32
|
-
<div>
|
33
|
-
<%= form.submit "Sign up" %>
|
32
|
+
<div class="mb-3">
|
33
|
+
<%= form.submit "Sign up", class: "btn btn-primary" %>
|
34
34
|
</div>
|
35
35
|
<% end %>
|
36
|
+
|
37
|
+
<div class="mb-3">
|
38
|
+
<%= link_to "Sign In", sign_in_path %> |
|
39
|
+
<%= link_to "Reset Password", new_identity_password_reset_path %> |
|
40
|
+
<%= link_to "Verify Email", identity_email_verification_path %>
|
41
|
+
</div>
|
@@ -4,27 +4,23 @@
|
|
4
4
|
<h1>Sign in</h1>
|
5
5
|
|
6
6
|
<%= form_with(url: sign_in_path) do |form| %>
|
7
|
-
<div>
|
7
|
+
<div class="mb-3">
|
8
8
|
<%= form.label :email, style: "display: block" %>
|
9
9
|
<%= form.email_field :email, value: params[:email_hint], required: true, autofocus: true, autocomplete: "email" %>
|
10
10
|
</div>
|
11
11
|
|
12
|
-
<div>
|
12
|
+
<div class="mb-3">
|
13
13
|
<%= form.label :password, style: "display: block" %>
|
14
14
|
<%= form.password_field :password, required: true, autocomplete: "current-password" %>
|
15
15
|
</div>
|
16
16
|
|
17
|
-
<div>
|
18
|
-
<%= form.submit "Sign in" %>
|
17
|
+
<div class="mb-3">
|
18
|
+
<%= form.submit "Sign in", class: "btn btn-primary" %>
|
19
19
|
</div>
|
20
20
|
<% end %>
|
21
21
|
|
22
|
-
<
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<div>
|
28
|
-
<%= link_to "Sign up", sign_up_path %> |
|
29
|
-
<%# link_to "Forgot your password?", new_identity_password_reset_path %>
|
22
|
+
<div class="mb-3">
|
23
|
+
<%= link_to "Sign Up", sign_up_path %> |
|
24
|
+
<%= link_to "Reset Password", new_identity_password_reset_path %> |
|
25
|
+
<%= link_to "Verify Email", identity_email_verification_path %>
|
30
26
|
</div>
|
data/lib/action_auth/version.rb
CHANGED