mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Updating sessions controller to use resource oriented style. Changing authenticate method to accept a hash of attributes.
This commit is contained in:
@@ -10,8 +10,9 @@ class SessionsController < ApplicationController
|
||||
# POST /session
|
||||
#
|
||||
def create
|
||||
if user = resource_class.authenticate(params[:session][:email], params[:session][:password]) #authenticate
|
||||
self.current_user = user
|
||||
self.resource = resource_class.authenticate(params[resource_name])
|
||||
if resource #authenticate
|
||||
self.current_user = resource
|
||||
flash[:success] = I18n.t(:signed_in, :scope => [:devise, :sessions], :default => 'Signed in successfully.')
|
||||
redirect_to root_path
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h2><%= t '.title', :default => 'Sign in', :scope => :devise %></h2>
|
||||
|
||||
<% form_for :session, :url => session_path do |f| -%>
|
||||
<% form_for resource_name, :url => session_path do |f| -%>
|
||||
<p><%= f.label :email %></p>
|
||||
<p><%= f.text_field :email %></p>
|
||||
<p><%= f.label :password %></p>
|
||||
|
||||
Reference in New Issue
Block a user