shopapp 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/shoplift_client.rb +10 -2
- data/app/views/shopapp/_shopapp.html.haml +18 -10
- data/shopapp.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49f5696249d271a1c19ddba0f9fc6619778f1a2e50ad17b9fa8c0c7d709d4832
|
4
|
+
data.tar.gz: 844680d5f91a98b0a8019552889632319f0e2999f0bd58a0e846bee55cf2307a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777ab542afd162169651992b6a7f4e7f5b27b2f50872ba9ac5892af7e95389eac005db2c1712c714978bc01feccbd605dbaa4414427556fda4c9b2b835f1dcde
|
7
|
+
data.tar.gz: 0a8c67173dda781cf9a887390a751cf68bf24ce5cff9fcd13dcd4d3224d0f33ed5bc0d7fce4333359f969b8271df50b635df7a3db955cf33d304acf8d6b082cb
|
@@ -132,6 +132,14 @@ module ShopliftClient
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
def handle_not_authorized(message)
|
136
|
+
if request.format.html?
|
137
|
+
redirect_unauthorized
|
138
|
+
else
|
139
|
+
fail ActionController::RoutingError, message
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
135
143
|
def authenticate_company!(soft = false)
|
136
144
|
return true if authenticate_user
|
137
145
|
|
@@ -145,7 +153,7 @@ module ShopliftClient
|
|
145
153
|
|
146
154
|
if @api_key.blank?
|
147
155
|
return false if soft
|
148
|
-
|
156
|
+
handle_not_authorized 'Authentication token missing'
|
149
157
|
end
|
150
158
|
|
151
159
|
response = srv.post 'auth/api_key',
|
@@ -156,7 +164,7 @@ module ShopliftClient
|
|
156
164
|
|
157
165
|
if response.blank?
|
158
166
|
return false if soft
|
159
|
-
|
167
|
+
handle_not_authorized 'Request not authorized'
|
160
168
|
end
|
161
169
|
|
162
170
|
@authentication = JSON.parse response.body
|
@@ -19,13 +19,16 @@
|
|
19
19
|
%i.fa.fa-search.mx-4(aria-hidden="true")
|
20
20
|
%ul.navbar-nav.ml-auto
|
21
21
|
= render 'layouts/header_menu'
|
22
|
-
|
23
|
-
%
|
24
|
-
%
|
25
|
-
|
26
|
-
-(
|
27
|
-
-
|
28
|
-
|
22
|
+
- if @current_user_json_hash['company']['apps'].present?
|
23
|
+
%li.nav-item.dropdown.ml-3
|
24
|
+
%a#navbarDropdown.nav-link.dropdown-toggle(href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
|
25
|
+
%i.fa.fa-th(aria-hidden="true")
|
26
|
+
.dropdown-menu.dropdown-menu-right(aria-labelledby="navbarDropdown")
|
27
|
+
-(@current_user_json_hash['company']['apps'] || []).each do |app|
|
28
|
+
- if app['home'].present?
|
29
|
+
%a.dropdown-item(href="#{app['home']}")
|
30
|
+
= image_tag "https://media.shoplift.fi/application_logos/#{app['name'].downcase}.svg", style: "padding-bottom: 3px; height: 24px;"
|
31
|
+
= app['name'].capitalize
|
29
32
|
%li.nav-item.dropdown.ml-md-2.ml-3.mr-3
|
30
33
|
%a#navbarDropdown.nav-link.dropdown-toggle(href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
|
31
34
|
%i.fa.fa-user(aria-hidden="true")
|
@@ -34,10 +37,15 @@
|
|
34
37
|
.dropdown-header
|
35
38
|
%strong Company:
|
36
39
|
=@current_user_json_hash['company']['name']
|
40
|
+
- if (@current_user_json_hash['memberships'] || []).reject { |c| @current_user_json_hash['company']['code'] == c['code'] }.present?
|
41
|
+
.dropdown-divider
|
42
|
+
.dropdown-header Change company
|
43
|
+
- (@current_user_json_hash['memberships'] || []).reject { |c| @current_user_json_hash['company']['code'] == c['code'] }.each do |c|
|
44
|
+
= link_to(change_company_path(c['code']), method: :post, :class => 'dropdown-item') do
|
45
|
+
%span(display="block" clear="none" style="width: 32px; margin-right: 6px;")
|
46
|
+
= image_tag "https://media.shoplift.fi/company_logos/#{c['logo_code']}_company_logo_24.png", style: "height: 16; width: 32px;"
|
47
|
+
= c['name']
|
37
48
|
.dropdown-divider
|
38
|
-
- (@current_user_json_hash['memberships'] || []).reject { |c| @current_user_json_hash['company']['code'] == c['code'] }.each do |c|
|
39
|
-
= link_to(change_company_path(c['code']), method: :post, :class => 'dropdown-item') do
|
40
|
-
Switch company to: #{c['name']}
|
41
49
|
= link_to(logout_path, method: :delete, :class => 'dropdown-item') do
|
42
50
|
Logout
|
43
51
|
.container-fluid
|
data/shopapp.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'shopapp'
|
3
|
-
s.version = '0.2.
|
4
|
-
s.date = '2018-
|
3
|
+
s.version = '0.2.12'
|
4
|
+
s.date = '2018-11-05'
|
5
5
|
s.summary = 'Do a shoplift.'
|
6
6
|
s.description = 'Ha! Art thou Bedlam? Dost thou thirst base Trojan, to have me fold up Parca\'s fatal web? Hence!\
|
7
7
|
I am qualmish at the smell of leek.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zeljko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|