Giter Site home page Giter Site logo

recd's Introduction

README

Welcome to RECd version 0.01!

Ever talk to a friend or a colleague who recommends a movie or a book to you? Sometimes you have no intention of following up on that recommendation, but sometimes you do, and RECd allows you to easily keep track of books and movie recommendations given to you. Simply sign up to RECd either manually or through facebook, add other users as friends, and recieve, give, and rate movie and book recommendations to your hearts content. You can also easily buy the kindle version of a book that has been recommended to you, as well as find out where any movie/show recommendation is streaming. Enjoy!

RECd URL: www.recd.co

User Stories: trello.com/b/7chtQsBB/alex-levine-recd

ERD www.lucidchart.com/invitations/accept/d7d869f2-aec2-4782-a0dd-fda7b8c715aa

recd's People

Contributors

alevsxm avatar

Watchers

 avatar  avatar

Forkers

dmaaron

recd's Issues

Devise and Facebook Omniauth -- Skipping Devise Email Confirmation Step if Someone Signs Up Through Facebook

I'm using Devise and Omniauth Facebook for authentication in my app. It seems to be working fine, except I would like to configure Devise so that if someone authenticates through Facebook, they don't need to confirm their email address to authenticate their account (whereas they need to if they sign up manually). My user model and omniauth call back controller are pasted below but let me know if there is anything else i can post that would be of use for solving the problem:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  #:lockable, :timeoutable
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable, :omniauthable,
         :omniauth_providers => [:facebook]

  # Books
  has_many :given_book_recommendations, :class_name => "BookRecommendation",
  :foreign_key => "recommendor_id", dependent: :destroy
  has_many :received_book_recommendations, :class_name => "BookRecommendation",
  :foreign_key => "recommendee_id", dependent: :destroy

  # Movies
  has_many :given_movie_recommendations, :class_name => "MovieRecommendation",
  :foreign_key => "recommendor_id", dependent: :destroy
  has_many :received_movie_recommendations, :class_name => "MovieRecommendation",
  :foreign_key => "recommendee_id", dependent: :destroy

  # Friendships
  has_many :friendships, dependent: :destroy
  has_many :friends, :through => :friendships

  # Friend Requests
  has_many :friend_requests, dependent: :destroy

  # Inverse Friendships...
  has_many :inverse_friendships, :class_name => "Friendship", :foreign_key => "friend_id"
  has_many :inverse_friends, :through => :inverse_friendships, :source => :user

  #Paperclip
  has_attached_file :avatar, :styles =>
  { :medium => "300x300>", :thumb => "100x100>" },
  :default_url => "/assets/:style/default_user_image.png"
  validates_attachment_content_type :avatar, :content_type => /\Aimage\/.*\Z/

  def self.from_omniauth(auth)
    where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
      user.email = auth.info.email
      user.password = Devise.friendly_token[0,20]
      user.first_name = auth.info.first_name   # assuming the user model has a name
      user.last_name = auth.info.last_name
      user.image = auth.info.image # assuming the user model has an image
    end
  end

  def self.new_with_session(params, session)
    super.tap do |user|
      if data = session["devise.facebook_data"] && session["devise.facebook_data"]["extra"]["raw_info"]
        user.email = data["email"] if user.email.blank?
      end
    end
  end

end

Here is my omniauth callback controller:

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController

  def facebook
    @user = User.from_omniauth(request.env["omniauth.auth"])

    if @user.persisted?
      sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
      set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
    else
      session["devise.facebook_data"] = request.env["omniauth.auth"]
      redirect_to new_user_registration_url
    end
  end

end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.