2015-01-03 2 views
0

coffeescript와 함께 Meteor를 사용하고 있습니다. Meteor 프로젝트 내부의 lib 폴더 아래에 methods.coffee라는 파일이 있습니다.Meteor는 coffeescript로 서버 측 세션을 사용할 수 없습니다.

if Meteor.isServer 
    Meteor.methods 
     authenticateUser: (email, password) -> 
      customerCursor = Customers.find({"email": email, "password": password}) 
      if customerCursor.count() 
       console.log "Authentication successful for #{email}" 
       customerArray = customerCursor.fetch() 
       Session.set("CID", customerArray[0].CID) 
       console.log "CustomerId #{Session.get("CID")} stored in session" 
       return true 
      else 
       console.log "Authentication failed for #{email}" 
       return false 

을 나는 방법에서 AuthenticateUser를 호출 할 때 오류가 세션이 정의되어 있지 말하는 슬로우되는, 다음과 같이 파일 내용의 미리보기입니다. Meteor 메소드 내부의 Session으로 설정할 수 있습니까? 가능하면 어떻게 할 수 있습니까? 미리 감사드립니다.

+0

[this] (https://gist.github.com/matteoagosti/2865146)도보세요. dandv 코멘트 (dandv 링크는 항상 유용 하하입니다.)를 더 보지 못해 죄송합니다. – Ethaan

답변

1

Session은 클라이언트에서만 사용할 수 있습니다. 서버에서 사용할 세션 값을 메소드 호출에서 인수로 전달해야합니다.

관련 문제