Commit bdec78734d09385ed6b58703138a26e57fbb321e

Authored by Victor Costa
1 parent a3d5af5f

oauth_client: generate private token for api access

plugins/oauth_client/lib/oauth_client_plugin.rb
... ... @@ -30,7 +30,11 @@ class OauthClientPlugin < Noosfero::Plugin
30 30 end
31 31  
32 32 def body_ending
33   - session.delete(:oauth_client_login) ? "<script>oauthPluginCloseLoginPopup(#{logged_in?}, '#{current_user.private_token}');</script>" : ''
  33 + if session.delete(:oauth_client_login)
  34 + current_user.private_token_expired? if current_user.present?
  35 + private_token = current_user.present? ? current_user.private_token : ''
  36 + "<script>oauthPluginCloseLoginPopup(#{logged_in?}, '#{private_token}');</script>"
  37 + end
34 38 end
35 39  
36 40 def js_files
... ...