lib/facemock/oauth/authentication.rb in facemock-oauth-0.0.3 vs lib/facemock/oauth/authentication.rb in facemock-oauth-0.0.4

- old
+ new

@@ -11,12 +11,12 @@ raw_body = URI.unescape(env['rack.input'].gets) body = query_string_to_hash(raw_body) email = body["email"] password = body["pass"] - user = Facemock::Database::User.find_by_email(email) + user = Facemock::User.find_by_email(email) if user && user.password == password - code = Facemock::Database::AuthorizationCode.create!(user_id: user.id) + code = Facemock::AuthorizationCode.create!(user_id: user.id) location = location(env, CallbackHook.path, { code: code.string }) else location = location(env, "/facemock/sign_in") end