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:
- 2246 Bytes
1 | class UsersController < ApplicationController |
2 | before_filter :login_required, :only => [:edit, :update, :destroy, :admin] |
3 | before_filter :find_user, :only => [:edit, :update, :destroy, :admin] |
4 | |
5 | def index |
6 | @user_pages, @users = paginate(:users, :per_page => 50, :order => "display_name", :conditions => (params[:q] && ['LOWER(display_name) LIKE :q OR LOWER(login) LIKE :q', {:q => "%#{params[:q]}%"}])) |
7 | end |
8 | |
9 | def show |
10 | @user = User.find(params[:id]) |
11 | end |
12 | |
13 | def new |
14 | @user = User.new |
15 | end |
16 | |
17 | def create |
18 | @user = params[:user].blank? ? User.find_by_email(params[:email]) : User.new(params[:user]) |
19 | flash[:error] = "I could not find an account with the email address '#{CGI.escapeHTML params[:email]}'. Did you type it correctly?" if params[:email] and not @user |
20 | redirect_to login_path and return unless @user |
21 | @user.login = params[:user][:login] unless params[:user].blank? |
22 | @user.reset_login_key! |
23 | UserMailer.deliver_signup(@user, request.host_with_port) |
24 | flash[:notice] = "#{params[:user].blank? ? "An account activation" : "A temporary login"} email has been sent to '#{CGI.escapeHTML @user.email}'." |
25 | redirect_to login_path |
26 | end |
27 | |
28 | def activate |
29 | self.current_user = User.find_by_login_key(params[:key]) |
30 | if logged_in? && !current_user.activated? |
31 | current_user.toggle! :activated |
32 | flash[:notice] = "Signup complete!" |
33 | end |
34 | redirect_to home_path |
35 | end |
36 | |
37 | def update |
38 | @user.attributes = params[:user] |
39 | # temp fix to let people with dumb usernames change them |
40 | @user.login = params[:user][:login] if not @user.valid? and @user.errors.on(:login) |
41 | @user.save! |
42 | redirect_to user_path(@user) |
43 | end |
44 | |
45 | def admin |
46 | @user.admin = params[:user][:admin] == '1' |
47 | @user.save |
48 | @user.forums << Forum.find(params[:moderator]) unless params[:moderator].blank? || params[:moderator] == '-' |
49 | redirect_to user_path(@user) |
50 | end |
51 | |
52 | def destroy |
53 | @user.destroy |
54 | redirect_to users_path |
55 | end |
56 | |
57 | protected |
58 | def authorized? |
59 | admin? || (!%w(destroy admin).include?(action_name) && (params[:id].nil? || params[:id] == current_user.id.to_s)) |
60 | end |
61 | |
62 | def find_user |
63 | @user = params[:id] ? User.find_by_id(params[:id]) : current_user |
64 | end |
65 | end |