mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 10:29:53 +01:00
Add generation of the Canny SSO token
This commit is contained in:
parent
4d4296de19
commit
7374aba6d3
5 changed files with 20 additions and 0 deletions
2
Gemfile
2
Gemfile
|
@ -64,6 +64,8 @@ gem "redis"
|
|||
|
||||
gem "fake_email_validator"
|
||||
|
||||
gem "jwt", "~> 2.3"
|
||||
|
||||
group :development do
|
||||
gem "binding_of_caller"
|
||||
gem "byebug"
|
||||
|
|
|
@ -291,6 +291,7 @@ GEM
|
|||
jquery-ui-rails (6.0.1)
|
||||
railties (>= 3.2.16)
|
||||
json (2.6.1)
|
||||
jwt (2.3.0)
|
||||
kaminari (1.2.2)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.2.2)
|
||||
|
@ -639,6 +640,7 @@ DEPENDENCIES
|
|||
httparty
|
||||
i18n-js (= 3.6)
|
||||
jbuilder (~> 2.10)
|
||||
jwt (~> 2.3)
|
||||
letter_opener
|
||||
mini_magick
|
||||
omniauth
|
||||
|
|
14
app/helpers/feedback_helper.rb
Normal file
14
app/helpers/feedback_helper.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
module FeedbackHelper
|
||||
def canny_token
|
||||
return if current_user.nil?
|
||||
|
||||
userData = {
|
||||
avatarURL: current_user.profile_picture.url(:large),
|
||||
name: current_user.screen_name,
|
||||
id: current_user.id,
|
||||
email: current_user.email
|
||||
}
|
||||
|
||||
JWT.encode(userData, APP_CONFIG.dig("canny", "sso"))
|
||||
end
|
||||
end
|
|
@ -6,5 +6,6 @@
|
|||
%script
|
||||
Canny('render', {
|
||||
boardToken: '#{APP_CONFIG['canny']['bug_board']}',
|
||||
ssoToken: '#{canny_token}',
|
||||
basePath: '/feedback/bugs'
|
||||
});
|
|
@ -6,5 +6,6 @@
|
|||
%script
|
||||
Canny('render', {
|
||||
boardToken: '#{APP_CONFIG['canny']['feature_board']}',
|
||||
ssoToken: '#{canny_token}',
|
||||
basePath: '/feedback/feature-requests'
|
||||
});
|
Loading…
Reference in a new issue