diff --git a/app/controllers/facebook_controller.rb b/app/controllers/facebook_controller.rb index 58cf9a0..728f314 100644 --- a/app/controllers/facebook_controller.rb +++ b/app/controllers/facebook_controller.rb @@ -79,15 +79,15 @@ class FacebookController < ApplicationController data = JSON.parse(friends) if data["success"] user = JSON.parse(data["user"]) - u = User.find(temp_user.id) - firstname = {} - lastname = {} - @site_valid_locales.each do |locale| - firstname[locale] = user["first_name"] - lastname[locale] = user["last_name"] - end - u.first_name_translations = firstname - u.last_name_translations = lastname + u = User.find(temp_user.id).member_profile + # firstname = {} + # lastname = {} + # @site_valid_locales.each do |locale| + # firstname[locale] = user["first_name"] + # lastname[locale] = user["last_name"] + # end + # u.first_name_translations = firstname + # u.last_name_translations = lastname u.office_tel = user["phone"] u.sex = user["gender"] || "unknown" u.remote_avatar_url = user["picture"] if user["picture"] @@ -111,7 +111,7 @@ class FacebookController < ApplicationController if !@url.nil? redirect_to @url else - render :layout=> "devise" + render :layout=> "authentication" end end end \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ccdc23b..b460a0e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -10,17 +10,23 @@ class UsersController < ApplicationController 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 + redirect_to users_confirmation_path + @user.generate_confirmation_token + url = "#{request.protocol}#{request.host_with_port}/#{locale.to_s}/users/confirm_user?token=#{@user.confirmation_token}" + email = Email.new(:mail_to => @user.member_profile.email, :mail_subject => "Confirmation email for orbit signup.", :template => "email/user_confirmation_email.html.erb", :template_data => {"url" => url}) + email.deliver else render "new" end end + def confirmation + end + def confirm_user user = User.confirm_email(params[:token]) - redirect_to users_path(:user_id => user.id.to_s) + redirect_to users_path(:user_id => user[:id]) if user[:success].eql?("true") flash[:notice] = "You have confirmed successfully" else @@ -51,19 +57,17 @@ class UsersController < ApplicationController end def role_page - @roles = [] - # @roles = Role.where(:disabled => false) + @roles = Role.where(:disabled => false) @user_id = params[:user_id] end def role_update user = User.find(params[:id]) member_profile = user.member_profile - if member_profile.update_attributes(params[:user]) + if member_profile.update_attributes(basic_info_params) redirect_to "/users/sign_in" else - @roles = [] - # @roles = Role.where(:disabled => false) + @roles = Role.where(:disabled => false) render :action => "role_page" end end @@ -81,6 +85,12 @@ class UsersController < ApplicationController private + def email_template(token) + html = "
Thank you for registering your site with Orbit! Please click on the following link and confirm. This is to make sure we could provide you with a spam free experience. Thanks a lot.
" + html = html + " @confirmation_token)%> \ No newline at end of file + Please click to confirm \ No newline at end of file diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 8e9c8db..6c09c27 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -9,7 +9,7 @@ OR -
+
diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb
index bbf41af..f86ecb5 100644
--- a/app/views/users/new.html.erb
+++ b/app/views/users/new.html.erb
@@ -1,10 +1,5 @@