ishapi 0.1.8.145 → 0.1.8.146
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7daed337d478761f910b4330f860a5c730a858dc50cf75272ef05ff6609459ef
|
4
|
+
data.tar.gz: 63ca6a01982f267a5cc411b32a0a949abb3d97ff5a2cdd43454b2a301607d8cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23e0af13c63e3ad5f24621cfd93f680f946bdebadc10d8bc2e5ed41a962c2c901237d839ae3f27a19ca01ede1e5cd73fe84649962247168db1127768c52dfb40
|
7
|
+
data.tar.gz: 1a0d67e6ff177b1d474538e4fb9a2770fb3f14872355a9ddba3b1cadeb69feaa644d3e3aa78b2d7e6fce1685e26bee74f9e6fd3f5c0551b576cdf9c71d2141b5
|
@@ -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
|
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.146
|
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
|