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 +4 -4
- data/lib/tramway/user/version.rb +1 -1
- data/lib/tramway/user.rb +0 -21
- metadata +4 -14
- data/app/controllers/concerns/auth_managment.rb +0 -29
- data/app/controllers/tramway/user/application_controller.rb +0 -15
- data/app/controllers/tramway/user/web/application_controller.rb +0 -5
- data/app/controllers/tramway/user/web/sessions_controller.rb +0 -32
- data/app/forms/tramway/user/session_form.rb +0 -14
- data/app/helpers/tramway/user/application_helper.rb +0 -10
- data/app/views/tramway/user/web/sessions/new.html.haml +0 -7
- data/config/locales/helpers.yml +0 -4
- data/config/locales/ru.yml +0 -7
- data/config/routes.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f172fc71da227bb6eecfa53e019a7275a8ff17ff78fc08911c9b79071adc08c
|
4
|
+
data.tar.gz: 4ee42e45e106fe3270902ab3f776568d823587af490ff25a5a35096d5b355c39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5608b665b8ee8d9d5f65770d55e518173e1b1320b069b0e7c30533f574ae00b67374062cf9b1822a85dba02a6ff6281b59e76fc0a0660a935b20ba62ec33db8
|
7
|
+
data.tar.gz: 0eeff16e6f881af9b748037ce706ff885617ef63e0c70dae14b7df45aec17c5e40260697de6d9963ac35e3582c7d6245c7ed1bc7eb84f1aa26c0cec7049380bf
|
data/lib/tramway/user/version.rb
CHANGED
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:
|
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
|
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/
|
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.
|
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,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,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'
|
data/config/locales/helpers.yml
DELETED
data/config/locales/ru.yml
DELETED