forked from saurabh/orbit4-5
38 lines
893 B
Ruby
38 lines
893 B
Ruby
class UsersController < ApplicationController
|
|
layout "authentication"
|
|
def new
|
|
@user = User.new
|
|
end
|
|
|
|
def create
|
|
@user = User.new(user_params)
|
|
if @user.save
|
|
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(:email, :password, :password_confirmation, :user_name)
|
|
end
|
|
end
|