authentication-zero 0.0.4 → 0.0.5

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: 6543f6ea3814c085db9b5d9dbc3543ef3ded98ffd0ac329e0055f704d08c5e92
4
- data.tar.gz: '0792d9e0d6e5bdfec32851dfc234aabf149f74b5abd991dd3f0b7c3d15ca2c78'
3
+ metadata.gz: fbbdce3e39368908b25db1e2b98b1c6f7d8211c43099270f87e2d5905307033e
4
+ data.tar.gz: be7a32894d05d9796a3baa46a6cf0907e3d0dc4808687c6238e8cda262c5edd3
5
5
  SHA512:
6
- metadata.gz: e44c73c52924721feb5dbd2c2d0dbb5b32ff9e12a29a59200834a2bcc091a3bb380d8cd8ade247f4db2d1abf8748b43b23d0853bb891b9f4105d2fec73777277
7
- data.tar.gz: 2357dc17f6c340cb5fde32f420415e80ed61b4ec8f697cfb15eefbb373aa1853b66da8b18e87f2821f3491f7c91965f0027cf670f0d3da94576b88089b5de086
6
+ metadata.gz: e5db73d7da96f46cb79e4b2ea51fbd6d4698436ed234e50f535a7ad02b28f1cedbf1768d1b67d032ac070ac7bdec0ea7ab309141b9593a034497421f335f65b4
7
+ data.tar.gz: 840de055d1877b02c0e52af876730bf5c1a87aafe99faf956f34e26736ecf0aa39907d86071b4956844e062f4a8f413ad83d4d4b30e773b5a5f111ff18729be1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (0.0.4)
4
+ authentication-zero (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -1,12 +1,14 @@
1
1
  class PasswordsController < ApplicationController
2
+ before_action :set_<%= singular_table_name %>
3
+
2
4
  def edit
3
5
  @<%= singular_table_name %> = Current.<%= singular_table_name %>
4
6
  end
5
7
 
6
8
  def update
7
- if !Current.<%= singular_table_name %>.authenticate(params[:current_password])
9
+ if !@<%= singular_table_name %>.authenticate(params[:current_password])
8
10
  redirect_to password_edit_path, alert: "The current password you entered is incorrect"
9
- elsif Current.<%= singular_table_name %>.update(password_params)
11
+ elsif @<%= singular_table_name %>.update(password_params)
10
12
  redirect_to root_path, notice: "Your password has been changed successfully"
11
13
  else
12
14
  render :edit, status: :unprocessable_entity
@@ -14,6 +16,10 @@ class PasswordsController < ApplicationController
14
16
  end
15
17
 
16
18
  private
19
+ def set_<%= singular_table_name %>
20
+ @<%= singular_table_name %> = Current.<%= singular_table_name %>
21
+ end
22
+
17
23
  def password_params
18
24
  params.require(:<%= singular_table_name %>).permit(:password, :password_confirmation)
19
25
  end
@@ -4,7 +4,7 @@ class <%= class_name %> < ApplicationRecord
4
4
 
5
5
  validates :email, presence: true, uniqueness: true
6
6
  validates :email, format: { with: /\A[^@\s]+@[^@\s]+\z/ }
7
- validates :password, length: 8..70, allow_blank: true
7
+ validates_length_of :password, minimum: 8, allow_blank: true
8
8
 
9
9
  before_validation { self.email = email.downcase.strip }
10
10
  end
@@ -17,7 +17,7 @@
17
17
 
18
18
  <div>
19
19
  <%%= label_tag :current_password, nil, style: "display: block" %>
20
- <%%= password_field_tag :current_password, autofocus: true, autocomplete: "current-password" %>
20
+ <%%= password_field_tag :current_password, nil, autofocus: true, autocomplete: "current-password" %>
21
21
  </div>
22
22
 
23
23
  <div>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-14 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: