Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 171
- Log:
Initial import of Beast 0.9 from downloaded Tarball. Beast is a Ruby
On Rails based forum application. The original tarball came from the
following location:http://s3.amazonaws.com/beast-forum/beast-0.9.tar.gz
The forum post which announced this version's availability was at:
http://beast.caboo.se/forums/1/topics/446
- Author:
- rool
- Date:
- Fri Mar 02 15:51:55 +0000 2007
- Size:
- 1902 Bytes
1 | module AuthenticationSystem |
2 | protected |
3 | # this is used to keep track of the last time a user has been seen (reading a topic) |
4 | # it is used to know when topics are new or old and which should have the green |
5 | # activity light next to them |
6 | # |
7 | # we cheat by not calling it all the time, but rather only when a user views a topic |
8 | # which means it isn't truly "last seen at" but it does serve it's intended purpose |
9 | # |
10 | # this could be a filter for the entire app and keep with it's true meaning, but that |
11 | # would just slow things down without any forseeable benefit since we already know |
12 | # who is online from the user/session connection |
13 | def update_last_seen_at |
14 | User.update_all ['last_seen_at = ?', Time.now.utc], ['id = ?', current_user.id] if logged_in? |
15 | end |
16 | |
17 | def login_required |
18 | login_by_token unless logged_in? |
19 | redirect_to login_path unless logged_in? && authorized? |
20 | end |
21 | |
22 | def login_by_token |
23 | self.current_user = User.find_by_id_and_login_key(*cookies[:login_token].split(";")) if cookies[:login_token] and not logged_in? |
24 | end |
25 | |
26 | def authorized?() true end |
27 | |
28 | def current_user=(value) |
29 | if @current_user = value |
30 | session[:user_id] = @current_user.id |
31 | # need to remove the unless RAILS_ENV when figure out how |
32 | # to make this work with tests |
33 | session.model.user_id = @current_user.id unless RAILS_ENV == "test" |
34 | # this is used while we're logged in to know which threads are new, etc |
35 | session[:last_active] = @current_user.last_seen_at |
36 | session[:topics] = session[:forums] = {} |
37 | update_last_seen_at |
38 | end |
39 | end |
40 | |
41 | def current_user |
42 | @current_user ||= ((session[:user_id] && User.find_by_id(session[:user_id])) || 0) |
43 | end |
44 | |
45 | def logged_in?() current_user != 0 end |
46 | |
47 | def admin?() logged_in? and current_user.admin? end |
48 | end |