summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/sessions_controller.rb8
-rw-r--r--app/controllers/users_controller.rb9
2 files changed, 10 insertions, 7 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index 8a9de56..722b8c2 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -7,19 +7,15 @@ class SessionsController < ApplicationController
user = User.find_by(email: params[:session][:email].downcase)
if user && user.authenticate(params[:session][:password])
sign_in user
- #redirect goes here
+ redirect_to root_path
else
render 'new'
end
end
def destroy
-
sign_out
-
- #I dont know where to redirect to so yeah
- # redirect_to sign_in
-
+ redirect_to root_path
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 74ab72c..2abc93e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,13 +1,14 @@
class UsersController < ApplicationController
def new
+ @user = User.new
end
def create
@user = User.new(user_params)
if @user.save
sign_in @user
- #redirect_to @user
+ #redirect_to root_path
else
render 'new'
end
@@ -16,4 +17,10 @@ class UsersController < ApplicationController
def show
@user = User.find(param[:id])
end
+
+ private
+
+ def user_params
+ params.require(:user).permit(:name, :email, :user_name, :password, :password_confirmation)
+ end
end