auto_auth 0.0.3 → 0.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 124e35dbaf07e7f25ab91f42ddad0d8ec3bdcdc9
4
- data.tar.gz: 67dfc04edc3aff03a9df21e488a1d5dbceabe148
3
+ metadata.gz: 85ce13e747cbe28e3cb93bc71c8981fb1fb73b41
4
+ data.tar.gz: 688522f50e5398653b7857e37df8a9fb2fc01925
5
5
  SHA512:
6
- metadata.gz: 08e40504f4c2a7730ed75a1b8fc59d50f748643227735a9969c145e3203d2ad1bae5e0a4335752ee1b3480636554d0c224a347207f646ab12984c12bff7cea27
7
- data.tar.gz: a3f89689bf45a58b30454a3ab6ac814e91d7352f4318ce2545163cf73e93c6258f89ff19e6bb19e63929391727ed2fc2027f67ce45f48e10f536b6b42fbda9df
6
+ metadata.gz: e4e18d54147130cdc07a94e66642e2bff8e661ec19657c8422dd046ba1121ae2cfffeb623319ed6d10220ff2c88bbf1eaf8acdd692c03aa98e896defe5d11d9b
7
+ data.tar.gz: 6d4517723ea858f7f53e6a3beecbe8c7024eebdec3e5374eeafbd04c75d20fbc33d9ff3a80039bd0a8e863c9535402b6ac6420d875739f807f04d348199b9304
@@ -24,6 +24,7 @@ module AutoAuth
24
24
 
25
25
  def add_gems
26
26
  gem "bcrypt"
27
+ gem "responders"
27
28
  end
28
29
 
29
30
  def create_model_files
@@ -1,3 +1,3 @@
1
1
  module AutoAuth
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -9,7 +9,7 @@ module Authentication
9
9
  end
10
10
 
11
11
  def sign_in!(<%= domain_model %>)
12
- session[:user_id] = user.id
12
+ session[:<%= domain_model %>_id] = <%= domain_model %>.id
13
13
  end
14
14
 
15
15
  def current_<%= domain_model %>
@@ -16,7 +16,7 @@ class PasswordsController < ApplicationController
16
16
  if <%= identity_model %> = <%= identity_model_class %>.find_by(email: email)
17
17
  <%= identity_mailer_class %>.reset_password(<%= identity_model %>).deliver
18
18
  end
19
- redirect_to(root_path, notice: t(:'auth_auth.passwords.reset_instructions'))
19
+ redirect_to(root_path, notice: t(:'auto_auth.passwords.reset_instructions'))
20
20
  end
21
21
 
22
22
  def update
@@ -4,7 +4,7 @@ class RegistrationsController < ApplicationController
4
4
 
5
5
  skip_before_action :authenticate!, only: [:new, :confirm, :create]
6
6
  before_action :redirect_authenticated, only: [:new, :create]
7
- before_action :setup_identity, only: [:confirm]
7
+ before_action :setup_<%= identity_model %>, only: [:confirm]
8
8
 
9
9
  def new
10
10
  @registration = Registration.new
@@ -12,7 +12,7 @@ class RegistrationsController < ApplicationController
12
12
 
13
13
  def confirm
14
14
  @<%= identity_model %>.confirm!
15
- redirect_to(root_path, notice: t(:'auto_auth.registration.confirmed'))
15
+ redirect_to(root_path, notice: t(:'auto_auth.registrations.confirmed'))
16
16
  end
17
17
 
18
18
  def create
@@ -30,7 +30,7 @@ class RegistrationsController < ApplicationController
30
30
  private
31
31
 
32
32
  def setup_<%= identity_model %>
33
- <%= identity_model_class %>.verify_signature!(Identity::EMAIL_CONFIRMATION_KEY, params.require(:email_confirmation_token)) do |record, expires_at|
33
+ <%= identity_model_class %>.verify_signature!(<%= identity_model_class %>::EMAIL_CONFIRMATION_KEY, params.require(:email_confirmation_token)) do |record, expires_at|
34
34
  if expires_at < Time.current
35
35
  redirect_to(root_path, alert: t(:'auto_auth.registrations.expired'))
36
36
  else
@@ -7,9 +7,9 @@ class SessionsController < ApplicationController
7
7
  end
8
8
 
9
9
  def create
10
- identity = <%= identity_model.classify %>.find_by(email: params[:session][:email])
11
- if identity && identity.authenticate(params[:session].delete(:password))
12
- session[:<%= "#{domain_model.underscore}_id" %>] = identity.<%= "#{domain_model.underscore}_id" %>
10
+ <%= identity_model %> = <%= identity_model.classify %>.find_by(email: params[:session][:email])
11
+ if <%= identity_model %> && <%= identity_model %>.authenticate(params[:session].delete(:password))
12
+ session[:<%= "#{domain_model.underscore}_id" %>] = <%= identity_model %>.<%= "#{domain_model.underscore}_id" %>
13
13
  redirect_to(after_sign_in_path, notice: t(:'auto_auth.sessions.signed_in'))
14
14
  else
15
15
  flash.now[:alert] = t(:'auto_auth.sessions.bad_combination')
@@ -7,7 +7,7 @@
7
7
  <%%= f.label :password %>
8
8
  <%%= f.password_field :password %>
9
9
  </p>
10
- <%%= submit_tag %>
10
+ <%%= submit_tag 'Sign In' %>
11
11
 
12
12
  <%%= link_to("Forgot password?", forgot_password_path) %>
13
13
  <%% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Schneider
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
11
+ date: 2015-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails