public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
update users.updated_at on login so the overview 'who done it?' is 
accurate

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1227 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Tue Jun 13 09:54:30 -0700 2006
commit  abbf5f783ace4360e26abf34d1d9d4de3d8ba340
tree    04d68b9afcad1c9d4a24eda53f8ea1b2fe7aa39c
parent  8436e1c07713e462c92de00e93bf391fbebef013
...
6
7
8
9
 
10
11
12
...
6
7
8
 
9
10
11
12
0
@@ -6,7 +6,7 @@ class Admin::OverviewController < Admin::BaseController
0
   helper Admin::ArticlesHelper
0
   
0
   def index
0
- @users = User.find(:all)
0
+ @users = User.find(:all, :order => 'updated_at desc')
0
     @events, @todays_events, @yesterdays_events = [], [], []
0
     today, yesterday = Time.now.to_date, 1.day.ago.to_date
0
     @articles = @site.articles.find(:all, :include => :unapproved_comments, :conditions => ['unapproved_comments_contents.id is not null and unapproved_comments_contents.approved = ?', false])
...
23
24
25
26
27
28
29
30
 
31
32
33
...
44
45
46
 
 
 
 
47
48
49
...
23
24
25
 
 
26
 
 
27
28
29
30
...
41
42
43
44
45
46
47
48
49
50
0
@@ -23,11 +23,8 @@ class User < ActiveRecord::Base
0
 
0
   # Authenticates a user by their login name and unencrypted password. Returns the user or nil.
0
   def self.authenticate(login, password)
0
- # use this instead if you want user activation
0
- # u = find :first, :select => 'id, salt', :conditions => ['login = ? and activated_at IS NOT NULL', login]
0
     u = find_by_login(login) # need to get the salt
0
- return nil unless u
0
- find :first, :conditions => ["id = ? AND crypted_password = ?", u.id, u.encrypt(password)]
0
+ u.save and return u if u && u.authenticated?(password)
0
   end
0
 
0
   # Encrypts some data with the salt.
0
@@ -44,6 +41,10 @@ class User < ActiveRecord::Base
0
     self.class.encrypt(password, salt)
0
   end
0
 
0
+ def authenticated?(password)
0
+ crypted_password == encrypt(password)
0
+ end
0
+
0
   def filters=(value)
0
     write_attribute :filters, [value].flatten.collect(&:to_sym)
0
   end

Comments

    No one has commented yet.