From 9a70f0e317e62993337e3e47382dcb7795d65652 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 3 Sep 2013 10:49:00 +0200 Subject: Cleanup sessions controller - webapp logs in through the api. So the #create and #update actions were not needed anymore. Also removed the tests --- users/app/controllers/sessions_controller.rb | 10 ---------- users/test/functional/sessions_controller_test.rb | 21 --------------------- 2 files changed, 31 deletions(-) diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb index d6c455b..0494b51 100644 --- a/users/app/controllers/sessions_controller.rb +++ b/users/app/controllers/sessions_controller.rb @@ -8,16 +8,6 @@ class SessionsController < ApplicationController end end - def create - logout if logged_in? - authenticate! - end - - def update - authenticate! - render :json => session.delete(:handshake) - end - def destroy logout redirect_to root_path diff --git a/users/test/functional/sessions_controller_test.rb b/users/test/functional/sessions_controller_test.rb index b22c3a3..a630e6e 100644 --- a/users/test/functional/sessions_controller_test.rb +++ b/users/test/functional/sessions_controller_test.rb @@ -41,27 +41,6 @@ class SessionsControllerTest < ActionController::TestCase assert_json_error :login => I18n.t(:all_strategies_failed) end - # Warden takes care of parsing the params and - # rendering the response. So not much to test here. - test "should perform handshake" do - request.env['warden'].expects(:authenticate!) - # make sure we don't get a template missing error: - @controller.stubs(:render) - post :create, :login => @user.login, 'A' => @client_hex - end - - test "should authorize" do - request.env['warden'].expects(:authenticate!) - handshake = stub(:to_json => "JSON") - session[:handshake] = handshake - - post :update, :id => @user.login, :client_auth => @client_hex - - assert_nil session[:handshake] - assert_response :success - assert_json_response handshake - end - test "logout should reset warden user" do expect_warden_logout delete :destroy -- cgit v1.2.3 From 78e918609a2a5cf9e0222dab81888de968e33222 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 3 Sep 2013 10:50:00 +0200 Subject: remove email aliases controller - we don't use it anymore --- users/app/controllers/email_aliases_controller.rb | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 users/app/controllers/email_aliases_controller.rb diff --git a/users/app/controllers/email_aliases_controller.rb b/users/app/controllers/email_aliases_controller.rb deleted file mode 100644 index c90432f..0000000 --- a/users/app/controllers/email_aliases_controller.rb +++ /dev/null @@ -1,12 +0,0 @@ -class EmailAliasesController < UsersBaseController - before_filter :fetch_user - - def destroy - @alias = @user.email_aliases.delete(params[:id]) - if @user.save - flash[:notice] = t(:email_alias_destroyed_successfully, :alias => bold(@alias)) - end - redirect_to edit_user_email_settings_path(@user) #TODO: this path doesn't exist. will want to add path for identities controller - end - -end -- cgit v1.2.3 From e81357bcb0be14a08aa185680b8b98ea92e45fab Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 3 Sep 2013 11:06:20 +0200 Subject: use the login logout named route instead of sessions resource The main part of the sessions resource now lives in the API. the two named routes are just fine for what is left. --- core/app/views/common/_home_page_buttons.html.haml | 2 +- users/config/routes.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/app/views/common/_home_page_buttons.html.haml b/core/app/views/common/_home_page_buttons.html.haml index 82a5cc2..7eb4c40 100644 --- a/core/app/views/common/_home_page_buttons.html.haml +++ b/core/app/views/common/_home_page_buttons.html.haml @@ -9,7 +9,7 @@ .span3 .row-fluid.second .login.span4 - %span.link= link_to(icon('ok-sign', icon_color) + t(:login), new_session_path, :class => 'btn') + %span.link= link_to(icon('ok-sign', icon_color) + t(:login), login_path, :class => 'btn') %span.info= t(:login_info) .signup.span4 %span.link= link_to(icon('user', icon_color) + t(:signup), new_user_path, :class => 'btn') diff --git a/users/config/routes.rb b/users/config/routes.rb index d4d5933..ccecfd5 100644 --- a/users/config/routes.rb +++ b/users/config/routes.rb @@ -10,7 +10,6 @@ Rails.application.routes.draw do get "login" => "sessions#new", :as => "login" delete "logout" => "sessions#destroy", :as => "logout" - resources :sessions, :only => [:new, :create, :update] get "signup" => "users#new", :as => "signup" resources :users, :except => [:create, :update] do -- cgit v1.2.3 From 31429466c9e21f3360c9b550fa93170200f15493 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 3 Sep 2013 11:08:42 +0200 Subject: clearify usage of V1::UsersController#index for autocomplete [skip ci] --- users/app/controllers/v1/users_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/users/app/controllers/v1/users_controller.rb b/users/app/controllers/v1/users_controller.rb index f380c19..4f82572 100644 --- a/users/app/controllers/v1/users_controller.rb +++ b/users/app/controllers/v1/users_controller.rb @@ -8,6 +8,7 @@ module V1 respond_to :json + # used for autocomplete for admins in the web ui def index if params[:query] @users = User.by_login.startkey(params[:query]).endkey(params[:query].succ) -- cgit v1.2.3