orbit4-5/app/controllers/users_controller.rb

41 lines
1.0 KiB
Ruby

class UsersController < ApplicationController
layout "authentication"
def new
@user = User.new
end
def create
@user = User.new(user_params)
@member = MemberProfile.new(email: params[:email])
if @user.save
@member.save
@user.update_attributes(member_profile_id: @member.id)
redirect_to root_url, :notice => "Signed Up Successfully, Please Check your email for confirmation!"
@user.send_confirmation_email
else
render "new"
end
end
def confirm_user
user = User.confirm_email(params[:token])
redirect_to post_confirmation_users_path
if user[:success].eql?("true")
flash[:notice] = "You have confirmed successfully"
else
flash[:notice] = "Error in confirmation please try again."
end
end
def post_confirmation
end
private
# Never trust parameters from the scary internet, only allow the white list through.
def user_params
params.require(:user).permit(:password, :password_confirmation, :user_name, :member_profile_id, :email)
end
end