Class: UsersController
Instance Method Summary
collapse
#authenticate, #current_user, #signed_in?, #signin, #signout
Instance Method Details
#create ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/generators/iceauth/templates/app/controllers/users_controller.rb', line 11
def create
@user = User.new(params[:user])
if @user.save
signin(@user)
redirect_to root_url, :flash => {:success => "Signed Up!" }
else
@title = "Sign Up"
render "new"
end
end
|
#edit ⇒ Object
22
23
24
|
# File 'lib/generators/iceauth/templates/app/controllers/users_controller.rb', line 22
def edit
@title = "Profile Settings"
end
|
#new ⇒ Object
6
7
8
9
|
# File 'lib/generators/iceauth/templates/app/controllers/users_controller.rb', line 6
def new
@user = User.new
@title = "Sign Up"
end
|
#update ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/generators/iceauth/templates/app/controllers/users_controller.rb', line 26
def update
if @user.authenticate(params[:user].delete(:current_password))
if @user.update_attributes(params[:user])
redirect_to edit_user_path(@user), :flash => {:success => "Settings Updated!"}
else
@title = "Profile Settings"
render 'edit'
end
else
@title = "Profile Settings"
flash[:error] = "Please provide correct current password to update profile settings"
render 'edit'
end
end
|