1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Build resource in all views.

This commit is contained in:
José Valim 2009-10-27 21:31:12 -02:00
parent dede8af5b0
commit dd3e534a19
12 changed files with 17 additions and 8 deletions

View file

@ -3,6 +3,7 @@ class ConfirmationsController < ApplicationController
# GET /resource/confirmation/new
def new
build_resource
end
# POST /resource/confirmation

View file

@ -5,6 +5,7 @@ class PasswordsController < ApplicationController
# GET /resource/password/new
def new
build_resource
end
# POST /resource/password

View file

@ -7,6 +7,7 @@ class SessionsController < ApplicationController
def new
unauthenticated! if params[:unauthenticated]
unconfirmed! if params[:unconfirmed]
build_resource
end
# POST /resource/sign_in
@ -16,6 +17,7 @@ class SessionsController < ApplicationController
redirect_back_or_to home_or_root_path
else
unauthenticated!
build_resource
render :new
end
end

View file

@ -1,6 +1,6 @@
<h2>Resend confirmation instructions</h2>
<% form_for resource_name, :url => confirmation_path(resource_name) do |f| %>
<% form_for resource, :url => confirmation_path(resource_name) do |f| %>
<%= f.error_messages %>
<p><%= f.label :email %></p>

View file

@ -1,6 +1,6 @@
<h2>Change your password</h2>
<% form_for resource_name, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
<% form_for resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :reset_password_token %>

View file

@ -1,6 +1,6 @@
<h2>Forgot your password?</h2>
<% form_for resource_name, :url => password_path(resource_name) do |f| %>
<% form_for resource, :url => password_path(resource_name) do |f| %>
<%= f.error_messages %>
<p><%= f.label :email %></p>

View file

@ -1,6 +1,6 @@
<h2>Sign in</h2>
<% form_for resource_name, :url => session_path(resource_name) do |f| -%>
<% form_for resource, :url => session_path(resource_name) do |f| -%>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>

View file

@ -1,6 +1,6 @@
<h2>Resend confirmation instructions</h2>
<% form_for resource_name, :url => confirmation_path(resource_name) do |f| %>
<% form_for resource, :url => confirmation_path(resource_name) do |f| %>
<%= f.error_messages %>
<p><%= f.label :email %></p>

View file

@ -1,6 +1,6 @@
<h2>Change your password</h2>
<% form_for resource_name, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
<% form_for resource, :url => password_path(resource_name), :html => { :method => :put } do |f| %>
<%= f.error_messages %>
<%= f.hidden_field :reset_password_token %>

View file

@ -1,6 +1,6 @@
<h2>Forgot your password?</h2>
<% form_for resource_name, :url => password_path(resource_name) do |f| %>
<% form_for resource, :url => password_path(resource_name) do |f| %>
<%= f.error_messages %>
<p><%= f.label :email %></p>

View file

@ -1,6 +1,6 @@
<h2>Sign in</h2>
<% form_for resource_name, :url => session_path(resource_name) do |f| -%>
<% form_for resource, :url => session_path(resource_name) do |f| -%>
<p><%= f.label :email %></p>
<p><%= f.text_field :email %></p>

View file

@ -78,6 +78,11 @@ module Devise
instance_variable_set(:"@#{resource_name}", new_resource)
end
# Build a devise resource
def build_resource
self.resource = resource_class.new(params[resource_name])
end
# Helper for use in before_filters where no authentication is required.
#
# Example: