Go directly to "My page" after login

Added by David Strejc about 10 years ago

Please,

can anybody skilled in RoR and redmine help me with little issue?

I would like to be redirected directly to "My page" after login - not to
index page. I've went through code myself but for now it is a little bit
hardcore for me.

Thanks a lot for any advice.

Replies (4)

RE: Go directly to "My page" after login - Added by Felix Kokocinski about 10 years ago

Hi David

as I understand it, you can decide where to take the user in the /app/controllers/account_controller.rb login function.
This will usually point to the "my page":
redirect_back_or_default :controller => 'my', :action => 'page'
but you should be able to enforce it like this:
redirect_to :controller => 'my', :action => 'page'

RE: Go directly to "My page" after login - Added by David Strejc about 10 years ago

Thanks a lot for your reply - I found that line in code before and I was disapointed,
because the first hint you wrote is there by default (so I was missing something).

But when I've changed redirect_back_or_default function to yours redirect_to it started
to work. So maybe I don't understand redirect_back_or_default function well as I don't
understand RoR for now.

But anyway thanks for your help.

Many thanks.

David

RE: Go directly to "My page" after login - Added by Keith Cascio about 10 years ago

Thank you Felix, this information helped me a lot.

RE: Go directly to "My page" after login - Added by Rupesh Helwade about 4 years ago

This seems to be quite old, breaks the Lost Password page.

Perhaps we need to change : /config/routes.rb
RedmineApp::Application.routes.draw do
root :to => 'welcome#index', :as => 'home'

Here we may have to change the route to appropriate.

I am using 2.3.1 stable version and possibly the code might have changed already.

(1-4/4)