{"action":"created","issue":{"url":"https://api.github.com/repos/openstax/accounts/issues/259","repository_url":"https://api.github.com/repos/openstax/accounts","labels_url":"https://api.github.com/repos/openstax/accounts/issues/259/labels{/name}","comments_url":"https://api.github.com/repos/openstax/accounts/issues/259/comments","events_url":"https://api.github.com/repos/openstax/accounts/issues/259/events","html_url":"https://github.com/openstax/accounts/issues/259","id":138555300,"number":259,"title":"undefined method `password_expired?` in IdentitiesController","user":{"login":"jpslav","id":1001691,"avatar_url":"https://avatars.githubusercontent.com/u/1001691?v=3","gravatar_id":"","url":"https://api.github.com/users/jpslav","html_url":"https://github.com/jpslav","followers_url":"https://api.github.com/users/jpslav/followers","following_url":"https://api.github.com/users/jpslav/following{/other_user}","gists_url":"https://api.github.com/users/jpslav/gists{/gist_id}","starred_url":"https://api.github.com/users/jpslav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpslav/subscriptions","organizations_url":"https://api.github.com/users/jpslav/orgs","repos_url":"https://api.github.com/users/jpslav/repos","events_url":"https://api.github.com/users/jpslav/events{/privacy}","received_events_url":"https://api.github.com/users/jpslav/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/openstax/accounts/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/openstax/accounts/labels/team:sustain","name":"team:sustain","color":"d4c5f9"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-04T18:55:00Z","updated_at":"2016-03-04T19:00:55Z","closed_at":null,"body":"Got a couple of exceptions with:\r\n\r\n```\r\nA NoMethodError occurred in identities#reset_password:\r\n\r\n  undefined method `password_expired?' for nil:NilClass\r\n  app/controllers/identities_controller.rb:40:in `reset_password'\r\n```\r\n\r\nThat offending line:\r\n\r\n```ruby\r\n    if !current_user.is_anonymous? && current_user.identity.password_expired?\r\n```\r\n\r\nThe `current_user` isn't anonymous but `current_user.identity` is `nil` (an \"identity\" is a password authentication in Accounts).  \r\n\r\nI would recommend [adding a spec here](https://github.com/openstax/accounts/blob/master/spec/features/reset_password_spec.rb).  The `create_user` call [at the top of that file](https://github.com/openstax/accounts/blob/master/spec/features/reset_password_spec.rb#L5) creates a dummy user with an identity, so you'll need to find a way to either create a non-anonymous user without an identity (maybe as an option to that `create_user` method) or have an option to add a non-identity authentication (probably some examples somewhere else of creating a user with a fake Facebook authentication).  \r\n\r\nUsers are sent to this reset password page [when their password expires](https://github.com/openstax/accounts/blob/ffc70e83754a7e44355448a5355a6f5617f3a30e/config/initializers/controllers.rb#L56).  And those people of course have identities.  So these must be some random arrivals.  A reasonable behavior for when a password-less person goes to reset_password would be to redirect them to the login page with a flash error that says \"Your password cannot be reset.  Please contact support for assistance.\" -- just in case they are not some random arrival and have a real need, we won't lose them."},"comment":{"url":"https://api.github.com/repos/openstax/accounts/issues/comments/192411300","html_url":"https://github.com/openstax/accounts/issues/259#issuecomment-192411300","issue_url":"https://api.github.com/repos/openstax/accounts/issues/259","id":192411300,"user":{"login":"Dantemss","id":1017808,"avatar_url":"https://avatars.githubusercontent.com/u/1017808?v=3","gravatar_id":"","url":"https://api.github.com/users/Dantemss","html_url":"https://github.com/Dantemss","followers_url":"https://api.github.com/users/Dantemss/followers","following_url":"https://api.github.com/users/Dantemss/following{/other_user}","gists_url":"https://api.github.com/users/Dantemss/gists{/gist_id}","starred_url":"https://api.github.com/users/Dantemss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dantemss/subscriptions","organizations_url":"https://api.github.com/users/Dantemss/orgs","repos_url":"https://api.github.com/users/Dantemss/repos","events_url":"https://api.github.com/users/Dantemss/events{/privacy}","received_events_url":"https://api.github.com/users/Dantemss/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T19:00:55Z","updated_at":"2016-03-04T19:00:55Z","body":"Most definitely. Make sure the message tells them to try FB/Google/Twitter. Or even figure out which one they have."}}