Trying to get authlogic running
This commit is contained in:
parent
06f09c0486
commit
737ff62cfc
23 changed files with 306 additions and 4 deletions
43
app/controllers/users_controller.rb
Normal file
43
app/controllers/users_controller.rb
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
class UsersController < ApplicationController
|
||||
|
||||
before_filter :require_user, :only => [:show, :edit, :update]
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
def create
|
||||
@user = User.new(params[:user])
|
||||
|
||||
# Saving without session maintenance to skip
|
||||
# auto-login which can't happen here because
|
||||
# the User has not yet been activated
|
||||
if @user.save
|
||||
flash[:notice] = "Your account has been created."
|
||||
redirect_to signup_url
|
||||
else
|
||||
flash[:notice] = "There was a problem creating you."
|
||||
render :action => :new
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
def edit
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
def update
|
||||
@user = current_user # makes our views "cleaner" and more consistent
|
||||
if @user.update_attributes(params[:user])
|
||||
flash[:notice] = "Account updated!"
|
||||
redirect_to account_url
|
||||
else
|
||||
render :action => :edit
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue