C0 code coverage information
Generated on Thu Jun 07 11:33:59 -0400 2007 with rcov 0.8.0
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 class AccountController < ApplicationController
2 # Be sure to include AuthenticationSystem in Application Controller instead
3 # If you want "remember me" functionality, add this before_filter to Application Controller
4 before_filter :login_from_cookie
5 layout "tournament"
6
7 # say something nice, you goof! something sweet.
8 def index
9 if User.count == 0
10 redirect_to(:action => 'signup')
11 elsif not logged_in?
12 redirect_to(:action => 'login')
13 else
14 redirect_to(:controller => '/main', :action => 'index')
15 end
16 end
17
18 def login
19 return unless request.post?
20 self.current_user = User.authenticate(params[:login], params[:password])
21 if current_user
22 if params[:remember_me] == "1"
23 self.current_user.remember_me
24 cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
25 end
26 redirect_back_or_default(:controller => '/account', :action => 'index')
27 flash[:notice] = "Logged in successfully"
28 end
29 end
30
31 def signup
32 @user = User.new(params[:user])
33 return unless request.post?
34 # This will be obsoleted by tournament signups
35 if User.count == 0
36 @user.rank = 1
37 end
38 @user.save!
39 self.current_user = @user
40 redirect_back_or_default(:controller => '/main', :action => 'index')
41 flash[:notice] = "Thanks for signing up!"
42 rescue ActiveRecord::RecordInvalid
43 render :action => 'signup'
44 end
45
46 def logout
47 self.current_user.forget_me if logged_in?
48 cookies.delete :auth_token
49 reset_session
50 flash[:notice] = "You have been logged out."
51 redirect_back_or_default(:controller => '/main', :action => 'index')
52 end
53 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.