shopapp 0.2.64 → 0.2.65

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: 3e76522947f310606b06cd0c94be0a018479194fd4c09e2b1f27c10019a60354
4
- data.tar.gz: 777d68b75bf8f8e0fabeed55e02183cb835ad58cfc081f1482ba1e97f80f8577
3
+ metadata.gz: b9a36e2f6ece1b23aad4a03d49d919a0e877321925a26204bb08a952cfe4cf76
4
+ data.tar.gz: 43d2a9d45768a7bc4185a8b666ec43d5fe7c6e0d83ee11bcc673b2a3b4d68685
5
5
  SHA512:
6
- metadata.gz: e15db8c0ed67bac56acfb4fff0329397ac09230806a9be85851cfae87242b466f5b1275702c42e6c68c46bc5e8f665e05c2f60a9dd3ce61502982a130125ed16
7
- data.tar.gz: 9f2272b8ff45d0637edbc761dd0bb09e6a31a9fc65bc4b83abf7d675a4835941a42a59ba9a0cb4a9ce8db3afbc511fa4b9bb1a42e4b9888209daf01ec07a6241
6
+ metadata.gz: e64145e1d24b14ea1af1ea59b53dde063f2058e099afc072556023ccad0e57a7bfe4d842f54a8d7c0ba9da29dda04574084f9a0d369f24bcebd73690b1295540
7
+ data.tar.gz: 729f88f254de28015e3c6dccb29b70d28bfb7bc5794d72fb815ed2cd683b729beaf82b6ca308a11977ff911819312c0a593c0b4ce068ccf6073a148a4a401865
data/README.md CHANGED
@@ -93,4 +93,4 @@ shopapp to support i18n, add two methods to your ApplicationController:
93
93
 
94
94
  To build new version of this gem, change the version in shopapp.gemspec and run:
95
95
 
96
- git push; gem build shopapp.gemspec ; gem push shopapp-0.2.64.gem; gem install shopapp
96
+ git push; gem build shopapp.gemspec ; gem push shopapp-0.2.65.gem; gem install shopapp
@@ -16,6 +16,7 @@ module ShopliftClient
16
16
  helper_method :company_logo_path_defined
17
17
  helper_method :supported_locales_defined
18
18
  helper_method :home_link_path
19
+ helper_method :shoplift_login_url
19
20
  end
20
21
 
21
22
  class_methods do
@@ -107,14 +108,22 @@ module ShopliftClient
107
108
  end
108
109
  end
109
110
 
110
- def redirect_unauthorized
111
+ def shoplift_login_url
112
+ client.auth_code.authorize_url(
113
+ redirect_uri: local_authlift_redirect_uri,
114
+ scope: scope)
115
+ end
116
+
117
+ def redirect_unauthorized(skip_landing_page = false)
111
118
  return if performed?
112
119
  session.clear
113
120
  session[:previous_url] = request.fullpath
114
121
 
115
- redirect_to client.auth_code.authorize_url(
116
- redirect_uri: local_authlift_redirect_uri,
117
- scope: scope)
122
+ if Rails.configuration.settings['use_welcome_screen'].present? && !skip_landing_page
123
+ redirect_to login_message_path
124
+ else
125
+ redirect_to shoplift_login_url
126
+ end
118
127
  end
119
128
 
120
129
  def scope
@@ -181,8 +190,8 @@ module ShopliftClient
181
190
  true
182
191
  end
183
192
 
184
- def authenticate_user!
185
- redirect_unauthorized unless authenticate_user
193
+ def authenticate_user!(skip_landing_page = false)
194
+ redirect_unauthorized(skip_landing_page) unless authenticate_user
186
195
  end
187
196
 
188
197
  def authenticate_user_or_api!
@@ -0,0 +1,22 @@
1
+ class ShopappLoginController < ApplicationController
2
+ include ShopliftClient
3
+
4
+ def welcome
5
+ unless Rails.configuration.settings['use_welcome_screen'].present?
6
+ redirect_to root_path
7
+ return
8
+ end
9
+
10
+ if authenticate_user
11
+ redirect_to root_path
12
+ else
13
+ if params['logged_in'] == 'false'
14
+ render 'shopapp/login_message', layout: nil
15
+ elsif params['logged_in'] == 'true'
16
+ authenticate_user! true
17
+ else
18
+ redirect_to "#{Rails.configuration.settings['authlift_url']}softly_verify_login"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5
+ %title OZZ Account Login
6
+ -# %link{:href => "https://fonts.googleapis.com/icon?family=Material+Icons", :rel => "stylesheet"}/
7
+ -# %link{:href => "https://fonts.googleapis.com/css?family=Fira+Sans:400,500,700", :rel => "stylesheet"}/
8
+ = csrf_meta_tags
9
+ = stylesheet_link_tag 'application', media: 'all'
10
+ = javascript_include_tag 'application'
11
+ = shopapp3_favicon
12
+ %body.bg-light
13
+ .row.justify-content-center
14
+ %div(class="#{@widebody ? 'col' : 'col-xl-5 col-lg-6 col-md-8 col-sm-10 col'}")
15
+ .container.pt-sm-5.pt-2
16
+ - if notice
17
+ .alert.alert-secondary.mt-3(role="alert")= notice
18
+ - if alert
19
+ .alert.alert-danger.mt-3(role="alert")= alert
20
+ .jumbotron.bg-secondary.text-light
21
+ .container.h-100
22
+ = image_tag company_logo_path_defined
23
+ %h2.pt-5 #{@current_shop_owner.name} B2B shop
24
+ %h1.mt-3 Welcome!
25
+ %p.mt-5
26
+ #{@current_shop_owner.name} B2B Shop is running on OZZ platform.
27
+ You need to login with your OZZ account to proceed.
28
+ = link_to shoplift_login_url do
29
+ %button.btn.btn-primary.btn-lg.float-right.my-5
30
+ Proceed to login
31
+ .clearfix
@@ -4,5 +4,7 @@ class ActionDispatch::Routing::Mapper
4
4
  post 'auth/change_company/:new_company_code', to: 'auth#change_company', as: 'change_company'
5
5
  post 'auth/change_language/:new_language_code', to: 'auth#change_language', as: 'change_language'
6
6
  delete 'auth', to: 'auth#destroy', as: 'logout'
7
+
8
+ get 'login', to: 'shopapp_login#welcome', as: 'login_message'
7
9
  end
8
- end
10
+ end
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.64'
4
- s.date = '2019-09-24'
3
+ s.version = '0.2.65'
4
+ s.date = '2019-09-25'
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.64
4
+ version: 0.2.65
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeljko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-24 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -414,6 +414,7 @@ files:
414
414
  - app/controllers/concerns/shopapp3.rb
415
415
  - app/controllers/concerns/shoplift_client.rb
416
416
  - app/controllers/concerns/shoplift_search.rb
417
+ - app/controllers/shopapp_login_controller.rb
417
418
  - app/controllers/user_authenticated_controller.rb
418
419
  - app/controllers/user_authenticated_or_api_controller.rb
419
420
  - app/helpers/euro_helper.rb
@@ -425,6 +426,7 @@ files:
425
426
  - app/views/shopapp/_shopapp2.html.haml
426
427
  - app/views/shopapp/_shopapp3.html.haml
427
428
  - app/views/shopapp/_shopapp_alerts.html.haml
429
+ - app/views/shopapp/login_message.haml
428
430
  - bin/shop
429
431
  - bin/shopitapp
430
432
  - config/initializers/active_settings.rb