This repository has been archived on 2021-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
greenlight/app/controllers/users_controller.rb

31 lines
465 B
Ruby
Raw Normal View History

2018-05-08 10:41:03 -04:00
class UsersController < ApplicationController
2018-05-31 15:04:18 -04:00
2018-05-09 16:31:52 -04:00
# GET /signup
def new
@user = User.new
end
# POST /signup
def create
user = User.new(user_params)
2018-05-10 15:03:59 -04:00
user.provider = "greenlight"
2018-05-31 15:04:18 -04:00
2018-05-09 16:31:52 -04:00
if user.save
2018-05-31 15:04:18 -04:00
login(user)
2018-05-09 16:31:52 -04:00
else
2018-05-31 15:04:18 -04:00
2018-05-09 16:31:52 -04:00
end
end
2018-05-25 11:55:48 -04:00
# GET /settings
def settings
redirect_to root_path unless current_user
end
2018-05-09 16:31:52 -04:00
private
def user_params
2018-05-31 15:04:18 -04:00
params.require(:user).permit(:name, :email, :password, :password_confirmation)
2018-05-09 16:31:52 -04:00
end
2018-05-25 11:55:48 -04:00
end