C0 code coverage information
Generated on Tue Dec 04 22:06:25 -0500 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 #####
2 #
3 # Copyright 2007 Chris Strom, Robin Strom
4 #
5 # This file is part of EEE Code (though much was auto-generated by the
6 # acts_as_authenticated plugin, which is licensed under the MIT
7 # license).
8 #
9 # EEE Code is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # EEE Code is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with EEE Code. If not, see <http://www.gnu.org/licenses/>.
21 #
22 class AccountController < ApplicationController
23 layout "home"
24
25 def index
26 if logged_in? && current_user.author?
27 redirect_to(:controller => 'author', :action => 'index')
28 return
29 end
30 redirect_to(:controller => 'home', :action => 'index')
31 end
32
33 def login
34 return unless request.post?
35 self.current_user = User.authenticate(params[:login], params[:password])
36 if logged_in?
37 expires = nil
38 if params[:remember_me] == "1"
39 self.current_user.remember_me
40 expires = self.current_user.remember_token_expires_at
41 cookies[:auth_token] = {:value => self.current_user.remember_token , :expires => expires}
42 end
43
44 cookies[:login] = {:value => self.current_user.login, :expires => expires}
45 cookies[:roles] = {:value => self.current_user.roles.map(&:name).join(" "), :expires => expires}
46
47 default_url = self.current_user.author? ? { :controller => 'author', :action => 'index' } : { :action => 'interstitial' }
48 redirect_back_or_default(default_url)
49 flash[:notice] = "Logged in successfully"
50 end
51 end
52
53 =begin
54 def signup
55 @user = User.new(params[:user])
56 return unless request.post?
57 @user.save!
58 self.current_user = @user
59 redirect_back_or_default(:controller => 'home', :action => 'index')
60 flash[:notice] = "Thanks for signing up!"
61 rescue ActiveRecord::RecordInvalid
62 render :action => 'signup'
63 end
64 =end
65
66 def logout
67 self.current_user.forget_me if logged_in?
68 cookies.delete :auth_token
69 cookies.delete :login
70 cookies.delete :roles
71 reset_session
72 flash[:notice] = "You have been logged out."
73 redirect_back_or_default(:action => 'interstitial')
74 end
75
76 def interstitial
77 @redirect_delay = 5
78 @redirect_url = url_for(:controller => 'home', :action => 'index')
79
80 if logged_in? && current_user.author?
81 @redirect_url = url_for(:controller => 'author', :action => 'index')
82 end
83 end
84 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.