<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,8 +4,8 @@ class SessionsController &lt; ApplicationController
   end
 
   def create
-    password = PLANETOID_CONF[:admin][:hash_password] ? Digest::SHA1.hexdigest(params[:password]) : params[:password]
-    if params[:login] == PLANETOID_CONF[:admin][:login].to_s &amp;&amp; params[:password] == PLANETOID_CONF[:admin][:password].to_s
+    password = PLANETOID_CONF[:admin][:hash_password] == true ? Digest::SHA1.hexdigest(params[:password]) : params[:password]
+    if params[:login] == PLANETOID_CONF[:admin][:login].to_s &amp;&amp; password == PLANETOID_CONF[:admin][:password].to_s
       session[:admin] = true
       flash[:notice] = &quot;Welcome, admin!&quot;
       redirect_to '/'</diff>
      <filename>app/controllers/sessions_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,8 @@ class SessionsControllerTest &lt; ActionController::TestCase
   
   def test_should_login_and_redirect_to_home
     assert_nil session[:admin]
+    PLANETOID_CONF[:admin][:hash_password] = false
+
     post :create, :login =&gt; PLANETOID_CONF[:admin][:login].to_s, :password =&gt; PLANETOID_CONF[:admin][:password].to_s
     assert_equal session[:admin], true
     assert_response :redirect
@@ -27,7 +29,7 @@ class SessionsControllerTest &lt; ActionController::TestCase
     PLANETOID_CONF[:admin][:hash_password] = true
     PLANETOID_CONF[:admin][:password] = Digest::SHA1.hexdigest('wadus')
     
-    post :create, :login =&gt; PLANETOID_CONF[:admin][:login].to_s, :password =&gt; PLANETOID_CONF[:admin][:password].to_s
+    post :create, :login =&gt; PLANETOID_CONF[:admin][:login].to_s, :password =&gt; 'wadus'
     assert_equal session[:admin], true
     assert_response :redirect
     assert_redirected_to '/'
@@ -47,11 +49,11 @@ class SessionsControllerTest &lt; ActionController::TestCase
     assert_nil session[:admin]
     PLANETOID_CONF[:admin][:hash_password] = true
     
-    post :create, :login =&gt; PLANETOID_CONF[:admin][:login].to_s, :password =&gt; PLANETOID_CONF[:admin][:password].to_s
-    assert_equal session[:admin], true
+    post :create, :login =&gt; PLANETOID_CONF[:admin][:login].to_s, :password =&gt; 'badpassword'
+    assert_nil session[:admin]
     assert_response :redirect
-    assert_redirected_to '/'
-    assert_not_nil flash[:notice]
+    assert_redirected_to '/login'
+    assert_not_nil flash[:error]
   end
 
   def test_should_logout_and_redirect_to_home</diff>
      <filename>test/functional/sessions_controller_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>205775c55ca2664ef0db5ce46732d62f5939bbbf</id>
    </parent>
  </parents>
  <author>
    <name>Juan Gallego</name>
    <email>juan@beecoder.com</email>
  </author>
  <url>http://github.com/jaimeiniesta/planetoid/commit/ec2549906971646167fe6d37a9e9e52e71a30851</url>
  <id>ec2549906971646167fe6d37a9e9e52e71a30851</id>
  <committed-date>2009-07-08T12:23:44-07:00</committed-date>
  <authored-date>2009-07-08T12:23:44-07:00</authored-date>
  <message>Some errors and tests fixed. All green.</message>
  <tree>bcd7624707ac614cae409b4edd30a07969101221</tree>
  <committer>
    <name>Juan Gallego</name>
    <email>juan@beecoder.com</email>
  </committer>
</commit>
