Class: AccountController

Inherits:
ApplicationController show all
Defined in:
app/controllers/account_controller.rb

Overview

Motiro - A project tracking tool

Copyright (C) 2006-2007  Thiago Arrais

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Instance Method Summary collapse

Methods inherited from ApplicationController

#check_desired_login_available, #drop_top_crumbs, #set_locale, #setup_renderer

Methods included from ApplicationHelper

#current_locale, #current_user, #dynjs_include_tag, #pagetext, #render_diff_table, #server_url_for

Instance Method Details

#authorizationObject



24
25
26
# File 'app/controllers/account_controller.rb', line 24

def authorization
  render :layout => false
end

#availabilityObject



53
54
55
# File 'app/controllers/account_controller.rb', line 53

def availability
  render :layout => false
end

#loginObject



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/account_controller.rb', line 28

def 
  case request.method
    when :post
    unless session[:user] = User.authenticate( params[:user][:login],
                                           params[:user][:password] )
      flash[:login_failure]  = true
    end
    redirect_back_or_default params[:return_to]
  end
end

#logoutObject



57
58
59
60
# File 'app/controllers/account_controller.rb', line 57

def logout
  session[:user] = nil
  redirect_back_or_default params[:return_to]
end

#signupObject



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'app/controllers/account_controller.rb', line 39

def 
  user = User.new(params[:user])
    
  if user.save
    session[:user] = User.authenticate( params[:user][:login],
                                        params[:user][:password] )

  else
    flash[:desired_login] = params[:user][:login]
  end

  redirect_back_or_default params[:return_to]
end