Hi! I'm devise and rails newbie.
Everything is cool except one problem:
i have controller with action "auto" which named RequestController
in action "auto" is different for re
i need to let user log in on this page and if the credentials he
specified are wrong, show message and if he authenticated ok, hide log
in form
so i've put this code in related View:
<%= form_tag :controller=>"requests", :action => "auto" do %>
<% if @login_msg %>
<h4><%= @login_msg %> </h4>
<% end %>
<table class="login">
<tr>
<td class="left"><%= label_tag :email, t(:email)
%></td>
<td><%= text_field_tag :email,
nil, :title=>"Логин", :class=>"text" %></td>
</tr>
<tr>
<td class="left"><%= label_tag :password,
t(:password) %></td>
<td><%= password_field_tag :password,
nil, :title=>"Пароль", :class=>"text" %></td>
</tr>
</table>
<%= submit_tag
t(:sign_in).capitalize, :class=>"green_button centered tmarg" %>
<% end %>
and in action wrote this:
class RequestsController < ApplicationController
require 'devise/strategies/authenticatable'
authorize_resource
def auto
if
request.post?
@user = warden.authenticate! :basic, params[:email],
params[:password]
sign_in(:user, @user)
end
end
"warden.authenticate! :basic, params[:email], params[:password]" is
wrong, i get error "Invalid strategy basic".
Please, could you tell me how to authenticate and sign in user and get
result in this action.
Thanks in advance.
Paul.