Hi, I'd like to know what is the best way to do this. Right now I can see
two options:
1) create a new views at make a custom controller for registration
controller to redirect to the right path
2) change the registration views that devise generates for you (so, for
example, the new view will have the session view inside it for the sign in
too)

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Walter Lee Davis at Jan 26, 2012 at 3:09 pm
    I just did this. I let Devise generate the views (rake task, check the wiki) and then I modified the devise/sessions/new layout to combine sign in and sign up.

    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links" %></div>

    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can see two options:
    1) create a new views at make a custom controller for registration controller to redirect to the right path
    2) change the registration views that devise generates for you (so, for example, the new view will have the session view inside it for the sign in too)

    Thanks in advance.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Rodrigo Ruiz at Jan 26, 2012 at 4:26 pm
    Do you think it is better than create a new view for it?
    On Thu, Jan 26, 2012 at 1:09 PM, Walter Lee Davis wrote:

    I just did this. I let Devise generate the views (rake task, check the
    wiki) and then I modified the devise/sessions/new layout to combine sign in
    and sign up.

    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url =>
    session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links"
    %></div>

    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can
    see two options:
    1) create a new views at make a custom controller for registration
    controller to redirect to the right path
    2) change the registration views that devise generates for you (so, for
    example, the new view will have the session view inside it for the sign in
    too)
    Thanks in advance.

    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Walter Lee Davis at Jan 26, 2012 at 6:14 pm

    On Jan 26, 2012, at 11:26 AM, Rodrigo Ruiz wrote:

    Do you think it is better than create a new view for it?
    I don't know about better, it was expedient and didn't create a third view file.

    Walter
    On Thu, Jan 26, 2012 at 1:09 PM, Walter Lee Davis wrote:
    I just did this. I let Devise generate the views (rake task, check the wiki) and then I modified the devise/sessions/new layout to combine sign in and sign up.

    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links" %></div>

    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can see two options:
    1) create a new views at make a custom controller for registration controller to redirect to the right path
    2) change the registration views that devise generates for you (so, for example, the new view will have the session view inside it for the sign in too)

    Thanks in advance.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Rodrigo Ruiz at Jan 26, 2012 at 7:00 pm
    I also want to render a different page if the user is loged in.

    How should I do that?

    Oh, and all that with the root url

    root :to => 'users/sessions/new'

    On Thu, Jan 26, 2012 at 3:37 PM, Walter Lee Davis wrote:

    On Jan 26, 2012, at 11:26 AM, Rodrigo Ruiz wrote:

    Do you think it is better than create a new view for it?
    I don't know about better, it was expedient and didn't create a third view
    file.

    Walter
    On Thu, Jan 26, 2012 at 1:09 PM, Walter Lee Davis wrote:
    I just did this. I let Devise generate the views (rake task, check the
    wiki) and then I modified the devise/sessions/new layout to combine sign in
    and sign up.
    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url =>
    session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links" %></div>
    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can
    see two options:
    1) create a new views at make a custom controller for registration
    controller to redirect to the right path
    2) change the registration views that devise generates for you (so,
    for example, the new view will have the session view inside it for the sign
    in too)
    Thanks in advance.

    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com
    .
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Rodrigo Ruiz at Jan 27, 2012 at 2:46 pm
    It didn't work, when I do

    devise_for :users do
    root :to => "devise/sessions#new"
    end

    because I want to log in in the root url and then remain there, but with a
    different rendering (logic is inside the new view of users/sessions)

    It keeps trying to redirect to the root url again and again, giving a
    message "Too many redirects occur..."

    What should I do?

    Thanks in advance

    On Thu, Jan 26, 2012 at 1:09 PM, Walter Lee Davis wrote:

    I just did this. I let Devise generate the views (rake task, check the
    wiki) and then I modified the devise/sessions/new layout to combine sign in
    and sign up.

    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url =>
    session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links"
    %></div>

    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can
    see two options:
    1) create a new views at make a custom controller for registration
    controller to redirect to the right path
    2) change the registration views that devise generates for you (so, for
    example, the new view will have the session view inside it for the sign in
    too)
    Thanks in advance.

    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Walter Lee Davis at Jan 27, 2012 at 3:38 pm

    On Jan 27, 2012, at 9:45 AM, Rodrigo Ruiz wrote:

    It didn't work, when I do

    devise_for :users do
    root :to => "devise/sessions#new"
    end

    because I want to log in in the root url and then remain there, but with a different rendering (logic is inside the new view of users/sessions)

    It keeps trying to redirect to the root url again and again, giving a message "Too many redirects occur..."

    What should I do?
    I think you need to re-think how this login will work. If you're trying to log in on a page, and then show that same page again after the user has logged in, what will trigger to the authentication system that the login is necessary?

    Devise is abstracted around solving this particular problem: User arrives at a page that she needs to be authenticated in order to see. She is redirected to a login page, authenticates, and then is redirected back to the originally requested page. If you're not trying to do that, then you have to add on to that behavior, not replace it, or you won't have much benefit to using this framework.

    Try this. Follow the examples (RailsCast has a very nice treatment of Devise, goes into all the nooks and crannies in two parts) and build the normal authentication system. Be sure to set a root page that is not the login path. Then add a *login form* to your root page (and optionally hide it if the user is logged in) using render partial in your view. This will be used to authenticate people who *want to* sign in before they are *required to* sign in.

    Walter
    Thanks in advance


    On Thu, Jan 26, 2012 at 1:09 PM, Walter Lee Davis wrote:
    I just did this. I let Devise generate the views (rake task, check the wiki) and then I modified the devise/sessions/new layout to combine sign in and sign up.

    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links" %></div>

    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can see two options:
    1) create a new views at make a custom controller for registration controller to redirect to the right path
    2) change the registration views that devise generates for you (so, for example, the new view will have the session view inside it for the sign in too)

    Thanks in advance.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Thiagocifani at Jan 27, 2012 at 3:54 pm
    Hello Rodrigo,

    if you need to redirect the user after login, there is a method in devise
    that make it. You should take a look in the documentation first, but the
    method is after_sign_in_path_for()


    cheers

    2012/1/27 Walter Lee Davis <waltd@wdstudio.com>
    On Jan 27, 2012, at 9:45 AM, Rodrigo Ruiz wrote:

    It didn't work, when I do

    devise_for :users do
    root :to => "devise/sessions#new"
    end

    because I want to log in in the root url and then remain there, but with
    a different rendering (logic is inside the new view of users/sessions)
    It keeps trying to redirect to the root url again and again, giving a
    message "Too many redirects occur..."
    What should I do?
    I think you need to re-think how this login will work. If you're trying to
    log in on a page, and then show that same page again after the user has
    logged in, what will trigger to the authentication system that the login is
    necessary?

    Devise is abstracted around solving this particular problem: User arrives
    at a page that she needs to be authenticated in order to see. She is
    redirected to a login page, authenticates, and then is redirected back to
    the originally requested page. If you're not trying to do that, then you
    have to add on to that behavior, not replace it, or you won't have much
    benefit to using this framework.

    Try this. Follow the examples (RailsCast has a very nice treatment of
    Devise, goes into all the nooks and crannies in two parts) and build the
    normal authentication system. Be sure to set a root page that is not the
    login path. Then add a *login form* to your root page (and optionally hide
    it if the user is logged in) using render partial in your view. This will
    be used to authenticate people who *want to* sign in before they are
    *required to* sign in.

    Walter
    Thanks in advance


    On Thu, Jan 26, 2012 at 1:09 PM, Walter Lee Davis wrote:
    I just did this. I let Devise generate the views (rake task, check the
    wiki) and then I modified the devise/sessions/new layout to combine sign in
    and sign up.
    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url =>
    session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links" %></div>
    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can
    see two options:
    1) create a new views at make a custom controller for registration
    controller to redirect to the right path
    2) change the registration views that devise generates for you (so,
    for example, the new view will have the session view inside it for the sign
    in too)
    Thanks in advance.

    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com
    .
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    thiagocifani
    http://thiagocifani.wordpress.com/
    twitter.com/thiagocifani
    del.icio.us/thiagocifani
    <http://del.icio.us/thiagocifani>

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Rodrigo Ruiz at Jan 27, 2012 at 4:41 pm
    The problem is that I want to redirect to the same url (meaning, I don't
    want to redirect, just want to go to the same route, and it will render a
    different view because I did this in the view with an "if user_sign_in?")
    On Fri, Jan 27, 2012 at 1:54 PM, thiagocifani wrote:

    Hello Rodrigo,

    if you need to redirect the user after login, there is a method in devise
    that make it. You should take a look in the documentation first, but the
    method is after_sign_in_path_for()


    cheers

    2012/1/27 Walter Lee Davis <waltd@wdstudio.com>
    On Jan 27, 2012, at 9:45 AM, Rodrigo Ruiz wrote:

    It didn't work, when I do

    devise_for :users do
    root :to => "devise/sessions#new"
    end

    because I want to log in in the root url and then remain there, but
    with a different rendering (logic is inside the new view of users/sessions)
    It keeps trying to redirect to the root url again and again, giving a
    message "Too many redirects occur..."
    What should I do?
    I think you need to re-think how this login will work. If you're trying
    to log in on a page, and then show that same page again after the user has
    logged in, what will trigger to the authentication system that the login is
    necessary?

    Devise is abstracted around solving this particular problem: User arrives
    at a page that she needs to be authenticated in order to see. She is
    redirected to a login page, authenticates, and then is redirected back to
    the originally requested page. If you're not trying to do that, then you
    have to add on to that behavior, not replace it, or you won't have much
    benefit to using this framework.

    Try this. Follow the examples (RailsCast has a very nice treatment of
    Devise, goes into all the nooks and crannies in two parts) and build the
    normal authentication system. Be sure to set a root page that is not the
    login path. Then add a *login form* to your root page (and optionally hide
    it if the user is logged in) using render partial in your view. This will
    be used to authenticate people who *want to* sign in before they are
    *required to* sign in.

    Walter
    Thanks in advance


    On Thu, Jan 26, 2012 at 1:09 PM, Walter Lee Davis <waltd@wdstudio.com> wrote:
    I just did this. I let Devise generate the views (rake task, check the
    wiki) and then I modified the devise/sessions/new layout to combine sign in
    and sign up.
    <%- title "Sign in or sign up" %>

    <div class="left half">
    <h3>Already registered?</h3>
    <%= form_for(resource, :as => resource_name, :url =>
    session_path(resource_name)) do |f| %>
    <p><%= f.label :email %><br />
    <%= f.email_field :email %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <% if devise_mapping.rememberable? -%>
    <p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
    <% end -%>

    <p><%= f.submit "Sign in" %></p>
    <% end %>
    </div>
    <div class="half left">
    <h3>Create an account</h3>
    <%= render :partial => 'devise/registrations/form' %>
    </div>
    <div style="clear:both"><%= render :partial => "devise/shared/links" %></div>
    Walter
    On Jan 26, 2012, at 9:58 AM, Rodrigo Ruiz wrote:

    Hi, I'd like to know what is the best way to do this. Right now I can
    see two options:
    1) create a new views at make a custom controller for registration
    controller to redirect to the right path
    2) change the registration views that devise generates for you (so,
    for example, the new view will have the session view inside it for the sign
    in too)
    Thanks in advance.

    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to
    rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.


    --
    You received this message because you are subscribed to the Google
    Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.

    --
    thiagocifani
    http://thiagocifani.wordpress.com/
    twitter.com/thiagocifani
    del.icio.us/thiagocifani
    <http://del.icio.us/thiagocifani>


    --
    You received this message because you are subscribed to the Google Groups
    "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 26, '12 at 2:58p
activeJan 27, '12 at 4:41p
posts9
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase