{"action":"created","issue":{"url":"https://api.github.com/repos/stormpath/express-stormpath/issues/310","repository_url":"https://api.github.com/repos/stormpath/express-stormpath","labels_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/310/labels{/name}","comments_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/310/comments","events_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/310/events","html_url":"https://github.com/stormpath/express-stormpath/pull/310","id":132705255,"number":310,"title":"JSON view model for GET on /login","user":{"login":"timothyej","id":721091,"avatar_url":"https://avatars.githubusercontent.com/u/721091?v=3","gravatar_id":"","url":"https://api.github.com/users/timothyej","html_url":"https://github.com/timothyej","followers_url":"https://api.github.com/users/timothyej/followers","following_url":"https://api.github.com/users/timothyej/following{/other_user}","gists_url":"https://api.github.com/users/timothyej/gists{/gist_id}","starred_url":"https://api.github.com/users/timothyej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timothyej/subscriptions","organizations_url":"https://api.github.com/users/timothyej/orgs","repos_url":"https://api.github.com/users/timothyej/repos","events_url":"https://api.github.com/users/timothyej/events{/privacy}","received_events_url":"https://api.github.com/users/timothyej/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/stormpath/express-stormpath/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/stormpath/express-stormpath/labels/needs%20review","name":"needs review","color":"e6e6e6"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/stormpath/express-stormpath/milestones/11","html_url":"https://github.com/stormpath/express-stormpath/milestones/2.5","labels_url":"https://api.github.com/repos/stormpath/express-stormpath/milestones/11/labels","id":1562710,"number":11,"title":"2.5","description":"Upgrades to comply with framework spec","creator":{"login":"robertjd","id":132343,"avatar_url":"https://avatars.githubusercontent.com/u/132343?v=3","gravatar_id":"","url":"https://api.github.com/users/robertjd","html_url":"https://github.com/robertjd","followers_url":"https://api.github.com/users/robertjd/followers","following_url":"https://api.github.com/users/robertjd/following{/other_user}","gists_url":"https://api.github.com/users/robertjd/gists{/gist_id}","starred_url":"https://api.github.com/users/robertjd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertjd/subscriptions","organizations_url":"https://api.github.com/users/robertjd/orgs","repos_url":"https://api.github.com/users/robertjd/repos","events_url":"https://api.github.com/users/robertjd/events{/privacy}","received_events_url":"https://api.github.com/users/robertjd/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":0,"state":"open","created_at":"2016-02-04T08:33:04Z","updated_at":"2016-02-11T16:38:22Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-02-10T13:51:15Z","updated_at":"2016-02-11T18:39:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/stormpath/express-stormpath/pulls/310","html_url":"https://github.com/stormpath/express-stormpath/pull/310","diff_url":"https://github.com/stormpath/express-stormpath/pull/310.diff","patch_url":"https://github.com/stormpath/express-stormpath/pull/310.patch"},"body":"Fixes #306.\r\n\r\nThis PR implements a JSON view model for `GET` on `/login` according to the [spec](https://github.com/stormpath/stormpath-framework-spec/blob/master/login.md#login-view-model).\r\n\r\n### Notes\r\n\r\n* This PR is going to be merged into `framework-spec-upgrade`.\r\n\r\n* I'm not sure if the account stores should only include SAML and social providers, or just all of them. If so, how do I filter them out?\r\n\r\n* Added some unit tests (all methods are not tested):\r\n\r\n  ```bash\r\nhelpers/get-login-view-model.js\r\n  getFormFields(config)\r\n    ✓ should return a non-empty array\r\n    ✓ should only return fields with `enabled` set to `true`\r\n    ✓ should remove the `enabled` property from returned fields\r\n    ✓ should return the fields in order of `config.web.login.fieldOrder`\r\n  getAccountStoreModel(accountStore)\r\n    ✓ should return an object\r\n    return object\r\n      ✓ should not be the accountStore object\r\n      ✓ should have href of accountStore\r\n      ✓ should have name of accountStore\r\n      .provider\r\n        ✓ should have href of accountStore.provider\r\n        ✓ should have callbackUri of accountStore.provider\r\n        ✓ should have clientId of accountStore.provider\r\n        ✓ should not have a clientSecret property\r\n```\r\n\r\n### How to verify\r\n\r\n1. Checkout this branch\r\n2. Clone [express-stormpath-sample-project](https://github.com/stormpath/express-stormpath-sample-project)\r\n3. Use `npm link` and `npm link express-stormpath` to link the library to the example project\r\n4. Make a `GET` request to `/login` with the `Accept` header set to `application/json`\r\n5. Verify that you get a JSON model back according to the [spec](https://github.com/stormpath/stormpath-framework-spec/blob/master/login.md#login-view-model)\r\n6. Try to edit the config (`web.login.fields` and `web.login.fieldOrder`) and verify that the fields and its order are correct\r\n7. Verify the content of `accountStores` and see my notes about it\r\n"},"comment":{"url":"https://api.github.com/repos/stormpath/express-stormpath/issues/comments/183002305","html_url":"https://github.com/stormpath/express-stormpath/pull/310#issuecomment-183002305","issue_url":"https://api.github.com/repos/stormpath/express-stormpath/issues/310","id":183002305,"user":{"login":"robertjd","id":132343,"avatar_url":"https://avatars.githubusercontent.com/u/132343?v=3","gravatar_id":"","url":"https://api.github.com/users/robertjd","html_url":"https://github.com/robertjd","followers_url":"https://api.github.com/users/robertjd/followers","following_url":"https://api.github.com/users/robertjd/following{/other_user}","gists_url":"https://api.github.com/users/robertjd/gists{/gist_id}","starred_url":"https://api.github.com/users/robertjd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertjd/subscriptions","organizations_url":"https://api.github.com/users/robertjd/orgs","repos_url":"https://api.github.com/users/robertjd/repos","events_url":"https://api.github.com/users/robertjd/events{/privacy}","received_events_url":"https://api.github.com/users/robertjd/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T18:39:19Z","updated_at":"2016-02-11T18:39:19Z","body":"Thanks @timothyej !  Please see inline comments for some additional feedback.  Looking good otherwise."}}