tramway-user 1.1.8 → 2.0

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: 52554de74bdeb3f23649eca7c1c601a332d7aef94169c05afa8bc80c750af0d3
4
- data.tar.gz: e91e191bd0a0c872c459b42e7fe9a2a1fd56a4ec13c6d4f1843fb61409aefd17
3
+ metadata.gz: 4f172fc71da227bb6eecfa53e019a7275a8ff17ff78fc08911c9b79071adc08c
4
+ data.tar.gz: 4ee42e45e106fe3270902ab3f776568d823587af490ff25a5a35096d5b355c39
5
5
  SHA512:
6
- metadata.gz: f1b303f599836906e3c4303821c5a4296fd51de0b278f3b018450c81bb2a1899e87a812560a47ea18abf564270b4a5a2bd3b132f8c7bc701cb9f7a678f83a005
7
- data.tar.gz: 71814f19adf0a5ebf20605ed39bd5889587481c6aad4fe3067f57c0118ae7426e59a5ecc5b5aadfbf8ac8c217b504544ed0a56f78c707a07c6acd17401a98f9a
6
+ metadata.gz: f5608b665b8ee8d9d5f65770d55e518173e1b1320b069b0e7c30533f574ae00b67374062cf9b1822a85dba02a6ff6281b59e76fc0a0660a935b20ba62ec33db8
7
+ data.tar.gz: 0eeff16e6f881af9b748037ce706ff885617ef63e0c70dae14b7df45aec17c5e40260697de6d9963ac35e3582c7d6245c7ed1bc7eb84f1aa26c0cec7049380bf
@@ -1,5 +1,5 @@
1
1
  module Tramway
2
2
  module User
3
- VERSION = '1.1.8'
3
+ VERSION = '2.0'
4
4
  end
5
5
  end
data/lib/tramway/user.rb CHANGED
@@ -3,26 +3,5 @@ require 'tramway/user/generators/install_generator'
3
3
 
4
4
  module Tramway
5
5
  module User
6
- class << self
7
- def root
8
- File.dirname __dir__
9
- end
10
-
11
- def layout_path=(path)
12
- @layout_path = path
13
- end
14
-
15
- def layout_path
16
- @layout_path ||= 'tramway/user/application'
17
- end
18
-
19
- def root_path=(path)
20
- @root_path = path
21
- end
22
-
23
- def root_path
24
- @root_path || '/'
25
- end
26
- end
27
6
  end
28
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tramway-user
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-10 00:00:00.000000000 Z
11
+ date: 2019-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt
@@ -64,22 +64,12 @@ files:
64
64
  - app/assets/javascripts/tramway/user/application.js
65
65
  - app/assets/javascripts/tramway/user/web/application.js
66
66
  - app/assets/stylesheets/tramway/user/application.sass
67
- - app/controllers/concerns/auth_managment.rb
68
- - app/controllers/tramway/user/application_controller.rb
69
- - app/controllers/tramway/user/web/application_controller.rb
70
- - app/controllers/tramway/user/web/sessions_controller.rb
71
67
  - app/decorators/tramway/user/user_decorator.rb
72
- - app/forms/tramway/user/session_form.rb
73
68
  - app/forms/tramway/user/user_form.rb
74
- - app/helpers/tramway/user/application_helper.rb
75
69
  - app/jobs/tramway/user/application_job.rb
76
70
  - app/mailers/tramway/user/application_mailer.rb
77
71
  - app/models/tramway/user/user.rb
78
- - app/views/tramway/user/web/sessions/new.html.haml
79
- - config/locales/helpers.yml
80
72
  - config/locales/models.yml
81
- - config/locales/ru.yml
82
- - config/routes.rb
83
73
  - lib/tasks/tramway/user_tasks.rake
84
74
  - lib/tramway/user.rb
85
75
  - lib/tramway/user/engine.rb
@@ -87,7 +77,7 @@ files:
87
77
  - lib/tramway/user/generators/templates/create_tramway_user_users.rb
88
78
  - lib/tramway/user/generators/templates/tramway_user.rb
89
79
  - lib/tramway/user/version.rb
90
- homepage: https://github.com/kalashnikovisme/tramway-user
80
+ homepage: https://github.com/ulmic/tramway-dev
91
81
  licenses:
92
82
  - MIT
93
83
  metadata: {}
@@ -107,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
97
  version: '0'
108
98
  requirements: []
109
99
  rubyforge_project:
110
- rubygems_version: 2.7.6
100
+ rubygems_version: 2.7.7
111
101
  signing_key:
112
102
  specification_version: 4
113
103
  summary: Engine for users in your Rails app
@@ -1,29 +0,0 @@
1
- module AuthManagment
2
- def sign_in(user)
3
- session[:user_id] = user.id
4
- end
5
-
6
- def sign_out
7
- session[:user_id] = nil
8
- end
9
-
10
- def signed_in?
11
- current_user
12
- end
13
-
14
- def authenticate_user!
15
- redirect_to new_session_path unless signed_in?
16
- end
17
-
18
- def authenticate_admin!
19
- if signed_in?
20
- redirect_to ::Tramway::User.root_path if !current_user.admin? && request.env['PATH_INFO'] != ::Tramway::User.root_path
21
- else
22
- redirect_to '/users/session/new'
23
- end
24
- end
25
-
26
- def current_user
27
- @_current_user ||= ::Tramway::User::User.find_by id: session[:user_id]
28
- end
29
- end
@@ -1,15 +0,0 @@
1
- module Tramway
2
- module User
3
- class ApplicationController < ActionController::Base
4
- layout ::Tramway::User.layout_path
5
- protect_from_forgery with: :exception
6
- before_action :application
7
-
8
- def application
9
- if ::Tramway::Core.application
10
- @application = Tramway::Core.application&.model_class&.first || Tramway::Core.application
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,5 +0,0 @@
1
- require_dependency "tramway/user/application_controller"
2
-
3
- class Tramway::User::Web::ApplicationController < ::Tramway::User::ApplicationController
4
- include AuthManagment
5
- end
@@ -1,32 +0,0 @@
1
- module Tramway::User
2
- module Web
3
- class SessionsController < ::Tramway::User::Web::ApplicationController
4
- before_action :redirect_if_signed_in, except: :destroy
5
-
6
- def new
7
- @session_form = ::Tramway::User::SessionForm.new ::Tramway::User::User.new
8
- end
9
-
10
- def create
11
- @session_form = ::Tramway::User::SessionForm.new User.find_or_initialize_by email: params[:user][:email]
12
- if @session_form.validate params[:user]
13
- sign_in @session_form.model
14
- redirect_to ::Tramway::User.root_path
15
- else
16
- render :new
17
- end
18
- end
19
-
20
- def destroy
21
- sign_out
22
- redirect_to root_path
23
- end
24
-
25
- private
26
-
27
- def redirect_if_signed_in
28
- redirect_to ::Tramway::User.root_path if signed_in? && request.env['PATH_INFO'] != ::Tramway::User.root_path
29
- end
30
- end
31
- end
32
- end
@@ -1,14 +0,0 @@
1
- module Tramway::User
2
- class SessionForm < ::Tramway::Core::ApplicationForm
3
- properties :email
4
- attr_accessor :password
5
-
6
- def model_name
7
- User
8
- end
9
-
10
- def validate(params)
11
- self.model.authenticate params[:password]
12
- end
13
- end
14
- end
@@ -1,10 +0,0 @@
1
- module Tramway
2
- module User
3
- module ApplicationHelper
4
- include AuthManagment
5
- include ::FontAwesome::Rails::IconHelper
6
- include Tramway::Core::TitleHelper
7
- include Tramway::Admin::NavbarHelper
8
- end
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- - title
2
- .row
3
- .col-md-6
4
- = simple_form_for @session_form.model, url: session_path, method: :post, html: { class: 'form-horizontal' } do |f|
5
- = f.input :email, as: :string
6
- = f.input :password
7
- = f.button :submit, t('helpers.links.enter'), class: 'btn btn-success'
@@ -1,4 +0,0 @@
1
- ru:
2
- helpers:
3
- links:
4
- enter: Войти
@@ -1,7 +0,0 @@
1
- ru:
2
- tramway:
3
- user:
4
- web:
5
- sessions:
6
- new:
7
- title: Авторизация
data/config/routes.rb DELETED
@@ -1,5 +0,0 @@
1
- Tramway::User::Engine.routes.draw do
2
- scope module: :web do
3
- resource :session, only: [ :new, :create, :destroy ]
4
- end
5
- end