jam-cloud/lib/managers/user_manager.rb

42 lines
1.1 KiB
Ruby

require 'recaptcha'
class UserManager < BaseManager
include Recaptcha::Verify
def initialize(options={})
super(options)
@log = Logging.logger[self]
end
def signup(first_name, last_name, email, password, password_confirmation,
city, state, country, instruments, photo_url, signup_confirm_url)
@user = User.new
# TODO: figure out why can't user verify_recaptcha here
# ALSO: make sure we dont do the recaptcha stuff if used facebook.
# check recaptcha; if any errors seen, contribute it to the model
#unless verify_recaptcha(:model => @user, :message => "recaptcha")
# return @user # @user.errors.any? is true now
#else
# sends email to email account for confirmation
@user = User.signup(first_name, last_name, email, password, password_confirmation,
city, state, country, instruments, photo_url, signup_confirm_url)
return @user
#end
end
def signup_confirm(signup_token)
begin
@user = User.signup_confirm(signup_token)
rescue ActiveRecord::RecordNotFound
@user = nil
end
return @user
end
end