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:
parent
dede8af5b0
commit
dd3e534a19
12 changed files with 17 additions and 8 deletions
|
@ -3,6 +3,7 @@ class ConfirmationsController < ApplicationController
|
|||
|
||||
# GET /resource/confirmation/new
|
||||
def new
|
||||
build_resource
|
||||
end
|
||||
|
||||
# POST /resource/confirmation
|
||||
|
|
|
@ -5,6 +5,7 @@ class PasswordsController < ApplicationController
|
|||
|
||||
# GET /resource/password/new
|
||||
def new
|
||||
build_resource
|
||||
end
|
||||
|
||||
# POST /resource/password
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 %>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 %>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue