Class: AccountController

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

Overview

Motiro - A project tracking tool

Copyright (C) 2006-2008  Thiago Arrais

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 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 Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

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, #parsing_error_box, #render_diff_table, #render_wiki, #server_url_for

Instance Method Details

#authorizationObject



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

def authorization
  render :layout => false
end

#availabilityObject



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

def availability
  render :layout => false
end

#loginObject



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

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



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

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

#signupObject



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

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