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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38c30b61f84668afa0e65809ee40daedd23bade1abd83915f01db62b80241978
4
- data.tar.gz: e85146f65486aa58c9df32b42b524121b5196be33fc66f37a620d588e128c421
3
+ metadata.gz: 4ae888409d5afb7a721b266a6952749b1abc3255a6f3d4671a9204c5b24dd8f4
4
+ data.tar.gz: 2eb44833be4f5d0d20f6b3318982697ca754fb3b9ce41f4698532557f0635ef1
5
5
  SHA512:
6
- metadata.gz: 92d04143a6e0592b38e19200ba796be3934f671bb3ccb5ab2b471bba34e9388740c3c0094dc17541a286c2dd5ae0ff1f71dcbf926432a4919dd6a2f95ed2300e
7
- data.tar.gz: cfa7aaea9e9de5e05d51d374fbddcccc764066676aa80948c2a0418046f34692723f8bb7924dc98c6687eb17c69699c7906a5fbe7747e19a0dd3104f09b2927e
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
- $ gem install authentication:install
35
+ rails g authentication:install
36
36
  ```
37
37
 
38
- Follow the instructions post-installation.
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
@@ -7,4 +7,4 @@ require "bundler/gem_tasks"
7
7
 
8
8
  task :version do
9
9
  p "v#{Yaag::VERSION}"
10
- end
10
+ end
@@ -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.successful"), status: :see_other
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
- <%= form_with url: signin_path do |form| %>
5
- <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: t("yaag.forms.signin_placeholder"), value: params[:email_address] %><br>
6
- <%= form.submit t("yaag.forms.signin_button") %>
7
- <% end %>
8
- <br>
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
- You can signin <%= link_to "with this link", create_session_url(@user.email_address_login_token) %>.
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 signin with the following link:
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) %>.
@@ -9,6 +9,7 @@ en:
9
9
  signin_placeholder: "Enter your email address"
10
10
  sessions:
11
11
  successful: "Signed in successfully."
12
+ destroy: "Signed out successfully."
12
13
  signins:
13
14
  email_sent: "Sign in address sent to provided e-mail."
14
15
  email_subject: "Sign in link"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Yaag
2
- VERSION = "0.0.19"
2
+ VERSION = "0.1.0"
3
3
  end
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.19
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: Passwordless authentication.
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: []