yaag 0.0.19 → 0.1.0
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 +14 -2
- data/Rakefile +1 -1
- data/app/controllers/sessions_controller.rb +2 -2
- data/app/views/signins/new.html.erb +11 -5
- data/app/views/signins_mailer/token.html.erb +3 -2
- data/app/views/signins_mailer/token.text.erb +2 -1
- data/config/locales/en.yml +1 -0
- data/lib/generators/authentication/copy/views_generator.rb +14 -0
- data/lib/generators/authentication/templates/README +6 -0
- data/lib/yaag/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4ae888409d5afb7a721b266a6952749b1abc3255a6f3d4671a9204c5b24dd8f4
|
|
4
|
+
data.tar.gz: 2eb44833be4f5d0d20f6b3318982697ca754fb3b9ce41f4698532557f0635ef1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c59715e2e986d0a012abd80f2d7376dbd106c28d2d9ec12c64bf8db2b1a0207e07760953e652cfdc6e259ec3100e025e9fdb516c6caa199bb424ab6127c06245
|
|
7
|
+
data.tar.gz: f20893f3c65274ab3ea55b41efb76d70132a3765f97155b837b4e6c0e21e5068a0d3a3055cf101b7ef10e46550fc2f5dcf1a64b05edaec011fde9ab168a4d958
|
data/README.md
CHANGED
|
@@ -32,10 +32,10 @@ bundle
|
|
|
32
32
|
|
|
33
33
|
Generate the authentication components (migrations, etc):
|
|
34
34
|
```bash
|
|
35
|
-
|
|
35
|
+
rails g authentication:install
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Follow the
|
|
38
|
+
Follow the on-screen post-installation instructions.
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
41
41
|
|
|
@@ -60,5 +60,17 @@ class MyController < ApplicationController
|
|
|
60
60
|
end
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
To create a copy of the views for customization, run:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
rails g authentication:copy:views
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Release
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git tag $(bundle exec rake version | tr -d '"') && git push --tags
|
|
73
|
+
```
|
|
74
|
+
|
|
63
75
|
## License
|
|
64
76
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
|
@@ -8,12 +8,12 @@ class SessionsController < ApplicationController
|
|
|
8
8
|
|
|
9
9
|
def create
|
|
10
10
|
start_new_session_for @user
|
|
11
|
-
redirect_to after_authentication_url
|
|
11
|
+
redirect_to after_authentication_url, notice: I18n.t("yaag.sessions.successful")
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def destroy
|
|
15
15
|
terminate_session
|
|
16
|
-
redirect_to new_signin_path, notice: I18n.t("yaag.sessions.
|
|
16
|
+
redirect_to new_signin_path, notice: I18n.t("yaag.sessions.destroy"), status: :see_other
|
|
17
17
|
end
|
|
18
18
|
private
|
|
19
19
|
def set_user_by_token
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
|
|
2
2
|
<%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %>
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<%= form
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
<div class="container w-50 ">
|
|
5
|
+
<h2>Sign In</h2>
|
|
6
|
+
<%= form_with url: signin_path do |form| %>
|
|
7
|
+
<div class="field mt-3">
|
|
8
|
+
<%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: t("yaag.forms.signin_placeholder"), value: params[:email_address], class: "form-control" %><br>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="actions mb-3">
|
|
11
|
+
<%= form.submit t("yaag.forms.signin_button"), class: "form-control btn btn-primary" %>
|
|
12
|
+
</div>
|
|
13
|
+
<% end %>
|
|
14
|
+
</div>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<p>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
Click <%= link_to "here", create_session_url(@user.email_address_login_token) %> to sign in.
|
|
3
|
+
</p>
|
|
4
|
+
<p>
|
|
4
5
|
This link will expire in <%= distance_of_time_in_words(0, @user.email_address_login_token_expires_in) %>.
|
|
5
6
|
</p>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
You can
|
|
1
|
+
You can sign in with the following link (copy and paste in the browser):
|
|
2
|
+
|
|
2
3
|
<%= create_session_url(@user.email_address_login_token) %>
|
|
3
4
|
|
|
4
5
|
This link will expire in <%= distance_of_time_in_words(0, @user.email_address_login_token_expires_in) %>.
|
data/config/locales/en.yml
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Authentication
|
|
2
|
+
module Copy
|
|
3
|
+
class ViewsGenerator < Rails::Generators::Base
|
|
4
|
+
source_root File.expand_path("../../../../", __dir__)
|
|
5
|
+
|
|
6
|
+
def copy_views
|
|
7
|
+
copy_file "app/views/sessions/new.html.erb"
|
|
8
|
+
copy_file "app/views/signins/new.html.erb"
|
|
9
|
+
copy_file "app/views/signins_mailer/token.html.erb"
|
|
10
|
+
copy_file "app/views/signins_mailer/token.text.erb"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -30,4 +30,10 @@ end
|
|
|
30
30
|
|
|
31
31
|
===============================================================
|
|
32
32
|
|
|
33
|
+
More generators available for customizations:
|
|
34
|
+
|
|
35
|
+
./bin/rails db:migrate g authentication:copy:views
|
|
36
|
+
|
|
37
|
+
===============================================================
|
|
38
|
+
|
|
33
39
|
See more at: https://github.com/nu12/yaag
|
data/lib/yaag/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yaag
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nu12
|
|
@@ -10,7 +10,8 @@ bindir: exe
|
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2026-01-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description:
|
|
13
|
+
description: Yet Another Authentication Gem (YAAG) provides passwordless authentication
|
|
14
|
+
for your Ruby on Rails app, all it takes is the user's e-mail address.
|
|
14
15
|
email:
|
|
15
16
|
- 34694287+nu12@users.noreply.github.com
|
|
16
17
|
executables: []
|
|
@@ -36,6 +37,7 @@ files:
|
|
|
36
37
|
- db/migrate/20260108164812_create_users.rb
|
|
37
38
|
- db/migrate/20260108165215_create_sessions.rb
|
|
38
39
|
- lib/generators/authentication/USAGE
|
|
40
|
+
- lib/generators/authentication/copy/views_generator.rb
|
|
39
41
|
- lib/generators/authentication/install_generator.rb
|
|
40
42
|
- lib/generators/authentication/templates/README
|
|
41
43
|
- lib/tasks/yaag_tasks.rake
|
|
@@ -66,5 +68,5 @@ requirements: []
|
|
|
66
68
|
rubygems_version: 3.4.19
|
|
67
69
|
signing_key:
|
|
68
70
|
specification_version: 4
|
|
69
|
-
summary: Passwordless authentication.
|
|
71
|
+
summary: Passwordless authentication for your Ruby on Rails app.
|
|
70
72
|
test_files: []
|