tramway-auth 1.1.0.3 → 1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c11a6584e129b2f9796a0595dd942024031b91f3db4216541d0e9f460f26926e
|
4
|
+
data.tar.gz: 55284eb1417d7e13fe43b53339cbc537a8272b2623a5b60ec49f0b143ca2e398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0431b5d2daa40b4d855c72c3d103f83480c12d73433e4018dc363bcf9664b5ddc195173f1c9b63146af0b31eea5dc2d283b3d299edd79f97770311ced2af60c9
|
7
|
+
data.tar.gz: 1a19b60ac2d116557797a81cf70d31a5f5fcf699448d754e6bbea153588dd3e904a91656eec21c37460fe9d4e20f3b2266434bbc7e09ebc9540f955cc2afeba0
|
@@ -1,17 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
11
|
-
|
12
|
-
|
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
|
data/config/routes.rb
CHANGED
data/lib/tramway/auth.rb
CHANGED
@@ -5,16 +5,16 @@ require 'tramway/auth/engine'
|
|
5
5
|
module Tramway
|
6
6
|
module Auth
|
7
7
|
class << self
|
8
|
-
def
|
9
|
-
@
|
8
|
+
def authenticable_models
|
9
|
+
@authenticable_models ||= []
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
@
|
12
|
+
def authenticable_models=(value)
|
13
|
+
@authenticable_models ||= []
|
14
14
|
if value.is_a? Array
|
15
|
-
@
|
15
|
+
@authenticable_models += value
|
16
16
|
else
|
17
|
-
@
|
17
|
+
@authenticable_models << value
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
data/lib/tramway/auth/version.rb
CHANGED
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.
|
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-
|
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
|