ishapi 0.1.8.144 → 0.1.8.148
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/app/controllers/ishapi/application_controller.rb +1 -1
- data/app/controllers/ishapi/my/my_controller.rb +5 -1
- data/app/controllers/ishapi/users_controller.rb +22 -0
- data/app/views/ishapi/maps/show.jbuilder +8 -0
- data/app/views/ishapi/newsitems/_index.jbuilder +2 -2
- data/app/views/ishapi/sites/show.jbuilder +0 -2
- data/config/routes.rb +1 -0
- 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: a6b93828545b3f0c63df48d764a930c0ce189a7b6c56d80ad8d71d22c12ff6af
|
4
|
+
data.tar.gz: 16ada34a0d549ced6d4bd3cb7103ddd074dac990bcc382f37ab48fa9753d4502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d950587452e9e0521ea2d5631aa26d7e46929ffe3ba24e31cf1b47c15f4811b089b3e5c67a0c7040ba507f5cc6e47dec914de37b3c90241601f8c5f301857c1
|
7
|
+
data.tar.gz: 0a1776f2adfaad26e1122efe3a38f19d5685ed8daa454512206f67dd9835fefe8b3ddfea921ad75f221647259a086285daabb08b863819b1d0cc93932aca3f66
|
@@ -8,8 +8,12 @@ module Ishapi
|
|
8
8
|
before_action :check_profile
|
9
9
|
|
10
10
|
def account
|
11
|
-
@profile = current_user
|
11
|
+
@profile = current_user&.profile
|
12
12
|
authorize! :show, @profile
|
13
|
+
rescue CanCan::AccessDenied
|
14
|
+
render json: {
|
15
|
+
status: :not_ok,
|
16
|
+
}, status: 401
|
13
17
|
end
|
14
18
|
|
15
19
|
private
|
@@ -4,6 +4,8 @@ module Ishapi
|
|
4
4
|
class UsersController < ApplicationController
|
5
5
|
before_action :set_profile, :only => [ :fb_sign_in, :show ]
|
6
6
|
|
7
|
+
skip_authorization_check only: %i| login |
|
8
|
+
|
7
9
|
def fb_sign_in
|
8
10
|
authorize! :fb_sign_in, Ishapi
|
9
11
|
# render :json => { :status => :ok }
|
@@ -14,5 +16,25 @@ module Ishapi
|
|
14
16
|
authorize! :fb_sign_in, Ishapi
|
15
17
|
end
|
16
18
|
|
19
|
+
def login
|
20
|
+
@current_user = User.where( email: params[:email] ).first
|
21
|
+
if !@current_user
|
22
|
+
render json: { status: :not_ok }, status: 401
|
23
|
+
return
|
24
|
+
end
|
25
|
+
if @current_user.valid_password?(params[:password])
|
26
|
+
# from: application_controller#long_term_token
|
27
|
+
|
28
|
+
# send the jwt to client
|
29
|
+
@jwt_token = encode(user_id: @current_user.id.to_s)
|
30
|
+
render json: {
|
31
|
+
email: @current_user.email,
|
32
|
+
jwt_token: @jwt_token,
|
33
|
+
long_term_token: @long_term_token,
|
34
|
+
n_unlocks: @current_user.profile.n_unlocks,
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
17
39
|
end
|
18
40
|
end
|
@@ -14,6 +14,14 @@ json.cache! this_key do
|
|
14
14
|
json.img_path @map.img_path
|
15
15
|
json.updated_at @map.updated_at
|
16
16
|
|
17
|
+
json.breadcrumbs do
|
18
|
+
json.array! @map.breadcrumbs do |b|
|
19
|
+
json.name b[:name]
|
20
|
+
json.slug b[:slug]
|
21
|
+
json.link b[:link]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
17
25
|
json.markers do
|
18
26
|
json.array! @markers do |marker|
|
19
27
|
json.name marker.name
|
@@ -23,7 +23,7 @@ json.newsitems do
|
|
23
23
|
if item.gallery.is_premium
|
24
24
|
json.premium_tier item.gallery.premium_tier
|
25
25
|
json.is_premium item.gallery.premium_tier > 0
|
26
|
-
json.is_purchased current_user
|
26
|
+
json.is_purchased current_user&.profile&.has_premium_purchase( item.gallery )
|
27
27
|
json.partial! 'ishapi/photos/index', :photos => [ item.gallery.photos[0] ]
|
28
28
|
else
|
29
29
|
json.partial! 'ishapi/photos/index', :photos => item.gallery.photos
|
@@ -48,7 +48,7 @@ json.newsitems do
|
|
48
48
|
if item.report.is_premium
|
49
49
|
json.premium_tier item.report.premium_tier
|
50
50
|
json.is_premium item.report.premium_tier > 0
|
51
|
-
json.is_purchased current_user
|
51
|
+
json.is_purchased current_user&.profile&.has_premium_purchase( item.report )
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -13,8 +13,6 @@ json.cache! key do
|
|
13
13
|
json.subhead @site.subhead
|
14
14
|
json.description @site.description
|
15
15
|
|
16
|
-
json.email @current_user.email
|
17
|
-
|
18
16
|
json.is_ads_enabled @site.is_ads_enabled
|
19
17
|
json.play_videos_in_preview @site.play_videos_in_preview
|
20
18
|
json.newsitems_per_page @site.newsitems_per_page
|
data/config/routes.rb
CHANGED
@@ -66,6 +66,7 @@ Ishapi::Engine.routes.draw do
|
|
66
66
|
post 'users/profile/update', :to => 'users#update'
|
67
67
|
get 'users/profile', :to => 'users#show' # @TODO: only for testing! accessToken must be hidden
|
68
68
|
match 'users/long_term_token', to: 'application#long_term_token', via: [ :get, :post ]
|
69
|
+
post 'users/login', to: 'users#login'
|
69
70
|
|
70
71
|
get 'venues', :to => 'venues#index'
|
71
72
|
get 'venues/view/:venuename', :to => 'venues#show'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ishapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.148
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|