Commit 87742f23 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Login field name changed to username (#755).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1181 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 9daf39ec
...@@ -43,7 +43,7 @@ class AccountController < ApplicationController ...@@ -43,7 +43,7 @@ class AccountController < ApplicationController
self.logged_user = nil self.logged_user = nil
else else
# Authenticate user # Authenticate user
user = User.try_to_login(params[:login], params[:password]) user = User.try_to_login(params[:username], params[:password])
if user if user
self.logged_user = user self.logged_user = user
# generate a key and set cookie if autologin # generate a key and set cookie if autologin
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<% form_tag({:action=> "login"}) do %> <% form_tag({:action=> "login"}) do %>
<table> <table>
<tr> <tr>
<td align="right"><label for="login"><%=l(:field_login)%>:</label></td> <td align="right"><label for="username"><%=l(:field_login)%>:</label></td>
<td align="left"><p><%= text_field_tag 'login', nil, :size => 40 %></p></td> <td align="left"><p><%= text_field_tag 'username', nil, :size => 40 %></p></td>
</tr> </tr>
<tr> <tr>
<td align="right"><label for="password"><%=l(:field_password)%>:</label></td> <td align="right"><label for="password"><%=l(:field_password)%>:</label></td>
...@@ -28,6 +28,6 @@ ...@@ -28,6 +28,6 @@
</td> </td>
</tr> </tr>
</table> </table>
<%= javascript_tag "Form.Element.focus('login');" %> <%= javascript_tag "Form.Element.focus('username');" %>
<% end %> <% end %>
</div> </div>
...@@ -45,7 +45,7 @@ class AccountControllerTest < Test::Unit::TestCase ...@@ -45,7 +45,7 @@ class AccountControllerTest < Test::Unit::TestCase
end end
def test_login_with_wrong_password def test_login_with_wrong_password
post :login, :login => 'admin', :password => 'bad' post :login, :username => 'admin', :password => 'bad'
assert_response :success assert_response :success
assert_template 'login' assert_template 'login'
assert_tag 'div', assert_tag 'div',
...@@ -56,7 +56,7 @@ class AccountControllerTest < Test::Unit::TestCase ...@@ -56,7 +56,7 @@ class AccountControllerTest < Test::Unit::TestCase
def test_autologin def test_autologin
Setting.autologin = "7" Setting.autologin = "7"
Token.delete_all Token.delete_all
post :login, :login => 'admin', :password => 'admin', :autologin => 1 post :login, :username => 'admin', :password => 'admin', :autologin => 1
assert_redirected_to 'my/page' assert_redirected_to 'my/page'
token = Token.find :first token = Token.find :first
assert_not_nil token assert_not_nil token
......
...@@ -49,7 +49,7 @@ class Test::Unit::TestCase ...@@ -49,7 +49,7 @@ class Test::Unit::TestCase
assert_equal nil, session[:user_id] assert_equal nil, session[:user_id]
assert_response :success assert_response :success
assert_template "account/login" assert_template "account/login"
post "/account/login", :login => login, :password => password post "/account/login", :username => login, :password => password
assert_redirected_to "my/page" assert_redirected_to "my/page"
assert_equal login, User.find(session[:user_id]).login assert_equal login, User.find(session[:user_id]).login
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment