simplify getting token communication
This commit is contained in:
@@ -17,21 +17,13 @@
|
|||||||
# $('body').append frame
|
# $('body').append frame
|
||||||
# window.location = "#{$obtain_token_url}"
|
# window.location = "#{$obtain_token_url}"
|
||||||
auth_win = window.open $obtain_token_url, "_blank", "location=no"
|
auth_win = window.open $obtain_token_url, "_blank", "location=no"
|
||||||
auth_win.addEventListener "loadstop", ->
|
auth_win.addEventListener "loadstart", (event)->
|
||||||
# auth_win.executeScript(code: "localStorage.setItem( 'name', '' );")
|
if event.url.match 'close_window'
|
||||||
watch_loop = setInterval ->
|
user_id = event.url.match(/user_id=([\w+-]+)/)[1]
|
||||||
auth_win.executeScript {code: "localStorage.getItem( 'auth_token' )"}, (values)->
|
auth_token = event.url.match(/auth_token=([\w-]+)/)[1]
|
||||||
token = values[0]
|
Qstorage.setItem 'user_id', user_id
|
||||||
if token
|
Qstorage.setItem 'auth_token', token
|
||||||
clearInterval( watch_loop )
|
auth_win.close()
|
||||||
auth_win.executeScript {code: "localStorage.setItem('auth_token', '');"}
|
|
||||||
auth_win.executeScript {code: "localStorage.getItem( 'user_id' )"}, (user_id_values)->
|
|
||||||
user_id = user_id_values[0]
|
|
||||||
Qstorage.setItem 'user_id', user_id
|
|
||||||
Qstorage.setItem 'auth_token', token
|
|
||||||
auth_win.close()
|
|
||||||
, 200
|
|
||||||
|
|
||||||
|
|
||||||
Ember.$.ajaxPrefilter (options) ->
|
Ember.$.ajaxPrefilter (options) ->
|
||||||
if options.type.toUpperCase() == 'GET'
|
if options.type.toUpperCase() == 'GET'
|
||||||
|
|||||||
@@ -4,10 +4,8 @@
|
|||||||
- if current_user.present?
|
- if current_user.present?
|
||||||
p Waiting for authentication to complete.....
|
p Waiting for authentication to complete.....
|
||||||
javascript:
|
javascript:
|
||||||
Qstorage = window.localStorage;
|
window.location.href = "/close_window?user_id=#{current_user.id}&authentication_token=#{current_user.authentication_token}"
|
||||||
Qstorage.setItem('auth_token', '#{current_user.authentication_token}');
|
// if(!window.opener || window.opener != window) window.close();
|
||||||
Qstorage.setItem('user_id', '#{current_user.id}');
|
|
||||||
if(!window.opener || window.opener != window) window.close();
|
|
||||||
// window.location = (Qstorage.getItem('root_url') || '/user/index.html') + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}';
|
// window.location = (Qstorage.getItem('root_url') || '/user/index.html') + '?user_id=#{current_user.id}&auth_token=#{current_user.authentication_token}';
|
||||||
// localStorage.setItem('auth_token', '#{current_user.authentication_token}');
|
// localStorage.setItem('auth_token', '#{current_user.authentication_token}');
|
||||||
// localStorage.setItem('user_id', '#{current_user.id}');
|
// localStorage.setItem('user_id', '#{current_user.id}');
|
||||||
|
|||||||
@@ -18,12 +18,14 @@ User
|
|||||||
----
|
----
|
||||||
|
|
||||||
- test met veel producten
|
- test met veel producten
|
||||||
- Change language
|
- Only show join requests menu when there actually are join requests
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
----
|
----
|
||||||
|
|
||||||
- nothing!!!
|
<!-- - nothing!!! -->
|
||||||
|
|
||||||
|
- User order added, not added for other users
|
||||||
|
|
||||||
Post release
|
Post release
|
||||||
============
|
============
|
||||||
|
|||||||
Reference in New Issue
Block a user