orbit4-5/app/controllers/users_controller.rb

38 lines
893 B
Ruby
Raw Normal View History

2014-04-10 04:01:34 +00:00
class UsersController < ApplicationController
2014-04-10 09:13:42 +00:00
layout "authentication"
2014-04-10 04:01:34 +00:00
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
2014-05-09 06:03:55 +00:00
redirect_to root_url, :notice => "Signed Up Successfully, Please Check your email for confirmation!"
@user.send_confirmation_email
2014-04-10 04:01:34 +00:00
else
render "new"
end
end
2014-05-09 06:03:55 +00:00
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
2014-04-10 04:01:34 +00:00
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)
2014-04-10 04:01:34 +00:00
end
end