source: ruby/trunk/rails/cancerehr/app/controllers/login_controller.rb@ 57

Last change on this file since 57 was 57, checked in by KOBAYASHI, Shinji, 15 years ago

add_user

File size: 627 bytes
Line 
1class LoginController < ApplicationController
2# layout "admin"
3 def add_user
4 @user = User.new(params[:user])
5 if request.post? and @user.save
6 flash.now[:notice] = "Created user:#{@user.name}."
7 @user = User.new
8 end
9 end
10
11 def login
12 session[:user_id] = nil
13 if request.post?
14 user = User.authenticate(params[:name], params[:passord])
15 if user
16 session[:user_id] = user.id
17 redirect_to(:action => "index")
18 else
19 flash[:notice] = "Invalid user"
20 end
21 end
22 end
23
24 def logout
25 end
26
27 def index
28 end
29
30 def deleteuser
31 end
32
33 def list_users
34 end
35end
Note: See TracBrowser for help on using the repository browser.