Green specs 😄
This commit is contained in:
@@ -13,14 +13,17 @@
|
||||
obtain_token: (message)->
|
||||
message ||= ''
|
||||
auth_win = window.open $obtain_token_url, "_blank", "location=no"
|
||||
auth_win.addEventListener "loadstart", (event)->
|
||||
auth_win.addEventListener "loadstart", (event)=>
|
||||
if event.url.match 'close_window'
|
||||
user_id = event.url.match(/user_id=([\w+-]+)/)[1]
|
||||
auth_token = event.url.match(/authentication_token=([\w-]+)/)[1]
|
||||
Qstorage.setItem 'user_id', user_id
|
||||
Qstorage.setItem 'auth_token', auth_token
|
||||
@handleAuthInfo(user_id, auth_token)
|
||||
auth_win.close()
|
||||
true
|
||||
handleAuthInfo: (user_id, auth_token)->
|
||||
Qstorage.setItem 'user_id', user_id
|
||||
Qstorage.setItem 'auth_token', auth_token
|
||||
@__container__.lookup('controller:application').setCurrentList()
|
||||
App.deferReadiness()
|
||||
Ember.$.ajaxPrefilter (options) ->
|
||||
if options.type.toUpperCase() == 'GET'
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script>localStorage.setItem('auth_token', '<%= params[:authentication_token] %>'); localStorage.setItem('user_id', '<%= params[:user_id] %>');window.close()</script>
|
||||
<script>
|
||||
if(window.parent && window.opener.App && window.opener.App.handleAuthInfo){
|
||||
window.opener.App.handleAuthInfo('<%= params[:user_id] %>', '<%= params[:authentication_token] %>');
|
||||
window.close();
|
||||
}else{
|
||||
localStorage.setItem('auth_token', '<%= params[:authentication_token] %>');
|
||||
localStorage.setItem('user_id', '<%= params[:user_id] %>');
|
||||
window.close();
|
||||
setTimeout(function(){alert('Something went wrong. Please restart the application and warnd the Mozo crew it the proplem persists')}, 5000);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user