Change videolistings to be not array until specified in the factory. Add email to authentication

This commit is contained in:
Tyrel Souza 2014-04-15 13:19:30 -04:00
parent 4cdb417179
commit 91b451180a
2 changed files with 5 additions and 7 deletions

View File

@ -5,17 +5,15 @@ class ApplicationController < ActionController::Base
before_action :authenticate_user_from_token! before_action :authenticate_user_from_token!
before_action :authenticate_user! #unless Rails.env.test? before_action :authenticate_user! #unless Rails.env.test?
private private
def authenticate_user_from_token! def authenticate_user_from_token!
user_token = params[:user_token].presence user_email = params[:user_email].presence
user = user_token && User.find_by_authentication_token(user_token.to_s) user = user_email && User.find_by_email(user_email)
if user if user && Devise.secure_compare(user.authentication_token, params[:user_token])
sign_in user, store:false sign_in user, store:false
end end
end end

View File

@ -11,6 +11,6 @@ FactoryGirl.define do
keywords "MyString" keywords "MyString"
focus "MyString" focus "MyString"
notes "MyString" notes "MyString"
asseturls ["MyString", "MyString2"] asseturls "MyString, MyString2"
end end
end end