From 40501f743d53e47eba035347e8fcac9343b9249d Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Wed, 24 Dec 2014 11:36:19 +0100 Subject: [PATCH] Go to user sign in page on token failure --- .../controllers/application_controller.js.coffee | 4 ---- .../app/controllers/settings_controller.js.coffee | 8 ++++++++ .../app/routes/application_route.js.coffee.erb | 7 ++++--- config/deploy.rb | 2 +- config/version | 2 +- .../users/sign_up_with_facebook.feature | 15 ++++++--------- wip.md | 2 ++ 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee index 7ed15c7e..b5172032 100644 --- a/app/assets/javascripts/user/app/controllers/application_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/application_controller.js.coffee @@ -11,10 +11,6 @@ App.ApplicationController = Ember.Controller.extend @set 'notice', null openDebugger: -> debugger - evalDebugString: -> - if text = $('#debug-eval-string') - $('.debug-info').append eval(text) - $('.debug-info').append "\n" currentPathDidChange: (-> @set 'notice', '' diff --git a/app/assets/javascripts/user/app/controllers/settings_controller.js.coffee b/app/assets/javascripts/user/app/controllers/settings_controller.js.coffee index 167c6da7..2968553e 100644 --- a/app/assets/javascripts/user/app/controllers/settings_controller.js.coffee +++ b/app/assets/javascripts/user/app/controllers/settings_controller.js.coffee @@ -1,2 +1,10 @@ App.SettingsController = Ember.Controller.extend locales: ['nl', 'en'] + actions: + evalDebugString: -> + if text = $('#debug-eval-string') + result = eval(text) + #result = JSON.stringify(result) + result = result.toString() + $('.debug-info').append result + $('.debug-info').append "\n" diff --git a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb index eea51772..8d3bc647 100644 --- a/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb +++ b/app/assets/javascripts/user/app/routes/application_route.js.coffee.erb @@ -11,10 +11,11 @@ App.ApplicationRoute = Ember.Route.extend @setCurrentList() unauthorized: -> - Qstorage.setItem('auth_token', '') + Qstorage.removeItem('auth_token') + Qstorage.removeItem('user_id') @controllerFor('application').set 'list', null - @send 'obtain_token' - @controllerFor('application').redirect_to 'index', message: 'unauthorized' + #@send 'obtain_token' + @controllerFor('application').redirect_to 'sign_in', message: 'unauthorized' handleAuthInfo: (user_id, auth_token)-> Qstorage.setItem 'user_id', user_id diff --git a/config/deploy.rb b/config/deploy.rb index 231f72f3..afef4b72 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,6 +1,6 @@ # config valid only for Capistrano 3.1 # lock '3.2.1' -require 'capistrano/local_precompile' +#require 'capistrano/local_precompile' set :application, 'mozo.bar' #set :repo_url, 'root@uflows.com:/var/git/qwaiter.git' diff --git a/config/version b/config/version index ea3f0d7a..68a59457 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -0.9.22 +0.9.23 diff --git a/spec/acceptance/users/sign_up_with_facebook.feature b/spec/acceptance/users/sign_up_with_facebook.feature index 6b930216..30d5f194 100644 --- a/spec/acceptance/users/sign_up_with_facebook.feature +++ b/spec/acceptance/users/sign_up_with_facebook.feature @@ -56,17 +56,14 @@ Feature: Sign up as user using facebook Then the user should be redirected to the homepage And the newly created user info should be stored in the local storage - @javascript @broken + @javascript Scenario: Expired token - Given there is no user information stored in the local storage - When the user is on the homepage + Given I am signed in as a user + And the user is on the homepage + When the user authentication token changes + And the user is on the homepage Then the user is redirected to the sign in page - When the user clicks the sign in via facebook button - Then the user should be redirected to the homepage - When the user has no active session - And the user authentication token changes - When the user is on the homepage - Then the newly created user info should be stored in the local storage + And there is no user information stored in the local storage Scenario: Facebook problem OmniAuth.config.mock_auth[:facebook] = :invalid_credentials Scenario: Valid facebook login, but declines information requested by scope diff --git a/wip.md b/wip.md index eb3bb4b5..670cd4b3 100644 --- a/wip.md +++ b/wip.md @@ -12,6 +12,7 @@ Supplier - Add qr-print button to tables - Product variants + User ---- @@ -19,6 +20,7 @@ User - product variants - remove active orders on list close - fix ajaxError duplicity +- rename "I am signed in as a user" to "there is a signed in user" Bugs ----