tramway-auth 1.1.0.3 → 1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d2473a57b2fa14a55ca4b0ebf937c407fffb0a77f36c7873ef0397986fc1d02
4
- data.tar.gz: 210d77cce88f4f85d4769856c91f1d5306bd030b165a22a23a808bb53c335ceb
3
+ metadata.gz: c11a6584e129b2f9796a0595dd942024031b91f3db4216541d0e9f460f26926e
4
+ data.tar.gz: 55284eb1417d7e13fe43b53339cbc537a8272b2623a5b60ec49f0b143ca2e398
5
5
  SHA512:
6
- metadata.gz: af9c60e64439b9f790c9c6af09416e0b7d7c626e3ffecc0c8bdf5f9d371a1e4e2da58636ee005499193e88561ff0a7fcc404819cbac9480cc2f87d0b5d977e96
7
- data.tar.gz: f4410b617a4657715bb720167a90779b9375f2d8fbbcc5b48ffaa14ea50e65c97b9ad3695acfb46d4b1a554de32a34278d5e27e026964daedaac5eedb5338ca2
6
+ metadata.gz: 0431b5d2daa40b4d855c72c3d103f83480c12d73433e4018dc363bcf9664b5ddc195173f1c9b63146af0b31eea5dc2d283b3d299edd79f97770311ced2af60c9
7
+ data.tar.gz: 1a19b60ac2d116557797a81cf70d31a5f5fcf699448d754e6bbea153588dd3e904a91656eec21c37460fe9d4e20f3b2266434bbc7e09ebc9540f955cc2afeba0
@@ -1,17 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Tramway
4
- module Auth
5
- class ApplicationController < ActionController::Base
6
- layout ::Tramway::Auth.layout_path
7
- protect_from_forgery with: :exception
8
- before_action :application
3
+ class Tramway::Auth::ApplicationController < Tramway::Core::ApplicationController
4
+ layout ::Tramway::Auth.layout_path
5
+ protect_from_forgery with: :exception
6
+ before_action :application
9
7
 
10
- def application
11
- if ::Tramway::Core.application
12
- @application = Tramway::Core.application&.model_class&.first || Tramway::Core.application
13
- end
14
- end
8
+ def application
9
+ if ::Tramway::Core.application
10
+ @application = Tramway::Core.application&.model_class&.first || Tramway::Core.application
15
11
  end
16
12
  end
17
13
  end
@@ -0,0 +1,18 @@
1
+ class Tramway::Auth::Web::SignUpsController < Tramway::Auth::Web::ApplicationController
2
+ before_action :check_authenticable_models
3
+
4
+ def create
5
+ @form = "#{model_class}SignUpForm".constantize.new model_class.new
6
+ if @form.submit params[:record]
7
+ redirect_to Rails.application.routes.url_helpers.root_path flash: :success
8
+ else
9
+ redirect_to Rails.application.routes.url_helpers.root_path flash: :error, errors: @form.errors.messages, record: @form.attributes
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def check_authenticable_models
16
+ return unless params[:model].in? Tramway::Auth.authenticable_models
17
+ end
18
+ end
@@ -3,5 +3,6 @@
3
3
  Tramway::Auth::Engine.routes.draw do
4
4
  scope module: :web do
5
5
  resource :session, only: %i[new create destroy]
6
+ resource :sign_up, only: :create
6
7
  end
7
8
  end
@@ -5,16 +5,16 @@ require 'tramway/auth/engine'
5
5
  module Tramway
6
6
  module Auth
7
7
  class << self
8
- def authenticable_classes
9
- @authenticable_classes ||= []
8
+ def authenticable_models
9
+ @authenticable_models ||= []
10
10
  end
11
11
 
12
- def authenticable_classes=(value)
13
- @authenticable_classes ||= []
12
+ def authenticable_models=(value)
13
+ @authenticable_models ||= []
14
14
  if value.is_a? Array
15
- @authenticable_classes += value
15
+ @authenticable_models += value
16
16
  else
17
- @authenticable_classes << value
17
+ @authenticable_models << value
18
18
  end
19
19
  end
20
20
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Tramway
4
4
  module Auth
5
- VERSION = '1.1.0.3'
5
+ VERSION = '1.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: 1.1.0.3
4
+ version: '1.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-03-05 00:00:00.000000000 Z
11
+ date: 2020-03-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails engine for auth
14
14
  email:
@@ -27,6 +27,7 @@ files:
27
27
  - app/controllers/tramway/auth/application_controller.rb
28
28
  - app/controllers/tramway/auth/web/application_controller.rb
29
29
  - app/controllers/tramway/auth/web/sessions_controller.rb
30
+ - app/controllers/tramway/auth/web/sign_ups_controller.rb
30
31
  - app/forms/tramway/auth/session_form.rb
31
32
  - app/helpers/tramway/auth/application_helper.rb
32
33
  - app/jobs/tramway/auth/application_job.rb