{"action":"created","issue":{"url":"https://api.github.com/repos/dburles/meteor-two-factor/issues/5","repository_url":"https://api.github.com/repos/dburles/meteor-two-factor","labels_url":"https://api.github.com/repos/dburles/meteor-two-factor/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/dburles/meteor-two-factor/issues/5/comments","events_url":"https://api.github.com/repos/dburles/meteor-two-factor/issues/5/events","html_url":"https://github.com/dburles/meteor-two-factor/issues/5","id":194155638,"number":5,"title":"twoFactorVerifyCodeAndLogin AND aldeed:collection2-core Compatibility","user":{"login":"Ontokrat","id":23409319,"avatar_url":"https://avatars.githubusercontent.com/u/23409319?v=3","gravatar_id":"","url":"https://api.github.com/users/Ontokrat","html_url":"https://github.com/Ontokrat","followers_url":"https://api.github.com/users/Ontokrat/followers","following_url":"https://api.github.com/users/Ontokrat/following{/other_user}","gists_url":"https://api.github.com/users/Ontokrat/gists{/gist_id}","starred_url":"https://api.github.com/users/Ontokrat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ontokrat/subscriptions","organizations_url":"https://api.github.com/users/Ontokrat/orgs","repos_url":"https://api.github.com/users/Ontokrat/repos","events_url":"https://api.github.com/users/Ontokrat/events{/privacy}","received_events_url":"https://api.github.com/users/Ontokrat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-07T20:10:05Z","updated_at":"2016-12-07T21:57:14Z","closed_at":null,"body":"Hi David ,\r\n\r\nFirst, thank you for your job, your 2FA plugin works great !\r\nSince two days ago, I tried to implement the aldeed:collection2-core plugin (pretty mainstream in meteor dev...). Here's my issue : \r\n\r\nThe creation of a user works & the new schema is attached to the user.\r\nBut I'm unable to log in my account: the first _login step_ works great, I receive the code, but the _verify step_ give me a 403 error \r\n`Error: Invalid code [403]\r\n    at [object Object].twoFactorVerifyCodeAndLogin (packages/dburles:two-factor/server.js:87:13)`\r\nSo this line is:\r\n```\r\n      if (options.code !== user[fieldName]) {                                                                // 86\r\n        throw new Meteor.Error(403, \"Invalid code\");                                                         // 87\r\n      }                                                                                                                            // 88\r\n\r\n```\r\n\r\nAt the end of my user schema, if I comment the last line \r\n`Meteor.users.attachSchema(Schema.User);`\r\neverything is back to normal - like a charm. But obviously, the new user schema is not attached to the user...\r\n\r\nAny idea of what is going on ? \r\nHelp me Obi Wan Kanobi.\r\n\r\n-----------------------\r\nIn details, in the Method _twoFactor.verifyCodeAndLogin_ : \r\n\r\n- At start: \r\n```\r\nuserId : null\r\nparams : [{\"user\":{\"email\":\"my@adress.com\"},\"password\":\"passpass\",\"code\":\"234926\"}]\r\n\r\n```\r\n- the find on users return:\r\n```\r\ncoll : users\r\nfunc : find\r\nselector : {\"emails.address\":\"my@adress.com\"}\r\n```\r\n\r\n-the fetch on users return:\r\n```\r\ncoll : users\r\nselector : {\"emails.address\":\"my@adress.com\"}\r\nfunc : fetch\r\ncursor : true\r\nlimit : 1\r\ndocsFetched : 1\r\ndocSize : 516\r\n```\r\n- then the error:\r\n```\r\nmessage: Invalid code [403] \r\nstack:\r\nError: Invalid code [403]\r\n    at [object Object].twoFactorVerifyCodeAndLogin (packages/dburles:two-factor/server.js:87:13)\r\n    at [object Object].methodMap.(anonymous function) (packages/meteorhacks_kadira.js:2731:30)\r\n    at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12)\r\n    at packages/ddp-server/livedata_server.js:711:19\r\n    at [object Object]._.extend.withValue (packages/meteor.js:1122:17)\r\n    at packages/ddp-server/livedata_server.js:709:40\r\n    at [object Object]._.extend.withValue (packages/meteor.js:1122:17)\r\n    at packages/ddp-server/livedata_server.js:707:46\r\n    at Session.method (packages/ddp-server/livedata_server.js:681:23)\r\n    at packages/meteorhacks_kadira.js:2619:38\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dburles/meteor-two-factor/issues/comments/265586011","html_url":"https://github.com/dburles/meteor-two-factor/issues/5#issuecomment-265586011","issue_url":"https://api.github.com/repos/dburles/meteor-two-factor/issues/5","id":265586011,"user":{"login":"dburles","id":319567,"avatar_url":"https://avatars.githubusercontent.com/u/319567?v=3","gravatar_id":"","url":"https://api.github.com/users/dburles","html_url":"https://github.com/dburles","followers_url":"https://api.github.com/users/dburles/followers","following_url":"https://api.github.com/users/dburles/following{/other_user}","gists_url":"https://api.github.com/users/dburles/gists{/gist_id}","starred_url":"https://api.github.com/users/dburles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dburles/subscriptions","organizations_url":"https://api.github.com/users/dburles/orgs","repos_url":"https://api.github.com/users/dburles/repos","events_url":"https://api.github.com/users/dburles/events{/privacy}","received_events_url":"https://api.github.com/users/dburles/received_events","type":"User","site_admin":false},"created_at":"2016-12-07T21:57:14Z","updated_at":"2016-12-07T21:57:14Z","body":"Hey @Ontokrat nicely written, I think all that's required is to add `twoFactorCode` to your user schema. Let me know if that fixes it."}}
{"actor":{"display_login":"dburles"}}