Rev | Line | |
---|
[57] | 1 | class 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
|
---|
| 35 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.