tramway-auth 2.0.1 → 2.0.2

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: 4adfdbe574a9d31bc8077b374b70157cfda825f0600269a4224b5ff177649f5f
4
- data.tar.gz: 83bfe0c4bbaa456ced5403604f7d451ba1a77267300d0d7eb084c7ceadd613e2
3
+ metadata.gz: 296edc29aec74f9944ac494dc9fd393384f1d060bc4110aede56e023a22ec8cc
4
+ data.tar.gz: 65612c69a4d28844ef172a4c113c7d97bea422b4eceda2951876238f6c81d43b
5
5
  SHA512:
6
- metadata.gz: ac20f69be6eda14d8563147ae5642dd056c36faf70269c8cbb03c0b9433902cd75b437e6760253930925aa2662ef41b00a0fbada4b05277b060837b95192f99b
7
- data.tar.gz: 42dcdfc8047a1ff5f13bf6985d3b101404deae427f85e5c3d7be798c3013978b0d0f9b1ce8823bb4302d56bd19f3b9c96f1c47c64e2736c8b749f47f3e36e465
6
+ metadata.gz: 3d2389875a90181944620b3188e6e2174e20933796007fc8b267b2d8ffbc7a7c11c4d7f207a973e525e470d7a58c20584602f05419c828f5c01dcc1ca5bde5dc
7
+ data.tar.gz: cfe0f77f8e1a049b1d9d1750d8d5cad9e64ba1f02dcc56ff5f56a506783bb337bce88cafa00faa7d816ff8b2ec3efd5b39baf2cfdfe4a30c85b8c695dfbb7135
@@ -21,6 +21,7 @@ module Tramway
21
21
  def current_user(user_class = ::Tramway::User::User)
22
22
  user = user_class.find_by id: session[user_id_key(user_class)]
23
23
  return false unless user
24
+
24
25
  "#{user_class}Decorator".constantize.decorate user
25
26
  end
26
27
 
@@ -7,11 +7,15 @@ module Tramway::Auth
7
7
 
8
8
  def create
9
9
  @session_form = ::Tramway::Auth::SessionForm.new params[:model].constantize.active.find_by email: params[:user][:email]
10
- if @session_form.validate params[:user]
11
- sign_in @session_form.model
12
- redirect_to [params[:success_redirect], '?', { flash: :success_user_sign_in }.to_query].join || ::Tramway::Auth.root_path_for(@session_form.model.class)
10
+ if @session_form.model.present?
11
+ if @session_form.validate params[:user]
12
+ sign_in @session_form.model
13
+ redirect_to [params[:success_redirect], '?', { flash: :success_user_sign_in }.to_query].join || ::Tramway::Auth.root_path_for(@session_form.model.class)
14
+ else
15
+ redirect_to [params[:error_redirect], '?', { flash: :error_user_sign_in }.to_query].join || ::Tramway::Auth.root_path_for(@session_form.model.class)
16
+ end
13
17
  else
14
- redirect_to [params[:error_redirect], '?', { flash: :error_user_sign_in }.to_query].join || ::Tramway::Auth.root_path_for(@session_form.model.class)
18
+ redirect_to [params[:error_redirect], '?', { flash: :error_user_sign_in }.to_query].join || ::Tramway::Auth.root_path_for(params[:model].constantize)
15
19
  end
16
20
  end
17
21
 
@@ -24,7 +28,9 @@ module Tramway::Auth
24
28
  private
25
29
 
26
30
  def redirect_if_signed_in
27
- redirect_to ::Tramway::Auth.root_path_for(current_user.class) if params[:model].present? && signed_in?(params[:model].constantize) && request.env['PATH_INFO'] != ::Tramway::Auth.root_path_for(current_user.class)
31
+ if params[:model].present? && signed_in?(params[:model].constantize) && request.env['PATH_INFO'] != ::Tramway::Auth.root_path_for(current_user.class)
32
+ redirect_to ::Tramway::Auth.root_path_for(current_user.class)
33
+ end
28
34
  end
29
35
  end
30
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Tramway::Auth::SignUpForm < Tramway::Core::ApplicationForm
2
4
  class << self
3
5
  attr_accessor :sign_in_after
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Auth
5
- VERSION = '2.0.1'
5
+ VERSION = '2.0.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-01 00:00:00.000000000 Z
11
+ date: 2020-09-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for auth
14
14
  email: