{"action":"created","issue":{"url":"https://api.github.com/repos/panique/huge/issues/705","labels_url":"https://api.github.com/repos/panique/huge/issues/705/labels{/name}","comments_url":"https://api.github.com/repos/panique/huge/issues/705/comments","events_url":"https://api.github.com/repos/panique/huge/issues/705/events","html_url":"https://github.com/panique/huge/issues/705","id":102391120,"number":705,"title":"[TO CLARIFY] Account Re-Verification on Email Change","user":{"login":"videsignz","id":13843898,"avatar_url":"https://avatars.githubusercontent.com/u/13843898?v=3","gravatar_id":"","url":"https://api.github.com/users/videsignz","html_url":"https://github.com/videsignz","followers_url":"https://api.github.com/users/videsignz/followers","following_url":"https://api.github.com/users/videsignz/following{/other_user}","gists_url":"https://api.github.com/users/videsignz/gists{/gist_id}","starred_url":"https://api.github.com/users/videsignz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/videsignz/subscriptions","organizations_url":"https://api.github.com/users/videsignz/orgs","repos_url":"https://api.github.com/users/videsignz/repos","events_url":"https://api.github.com/users/videsignz/events{/privacy}","received_events_url":"https://api.github.com/users/videsignz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-08-21T14:29:50Z","updated_at":"2015-10-11T18:46:17Z","closed_at":null,"body":"I was thinking...\r\nIf we use email verification for an account on creation, why would we not do the same when a user changes their email?\r\n\r\nTo me this only makes sense. It could go something like this...\r\n1. User changes email and is logged out\r\n2. User DB status changes back to inactive\r\n3. Email resent to verify\r\n4. Link clicked to reactivate\r\n\r\nObviously there should be some sort of notification shown to the user alerting them that their account will be set back to inactive.\r\n\r\nThoughts?\r\n\r\nHere is a quick setup for the function (Not tested)\r\n\r\n```php\r\n    public static function saveNewEmailAddress($user_id, $new_user_email)\r\n    {\r\n        $database = DatabaseFactory::getFactory()->getConnection();\r\n\t\t$user_activation_hash = sha1(uniqid(mt_rand(), true));\r\n\r\n        $query = $database->prepare(\"UPDATE users SET user_email = :user_email, user_active = :user_active, user_activation_hash = :user_activation_hash WHERE user_id = :user_id LIMIT 1\");\r\n        $query->execute(array(':user_email' => $new_user_email, ':user_active' => 0, ':user_activation_hash' => $user_activation_hash, ':user_id' => $user_id));\r\n        $count =  $query->rowCount();\r\n        if ($count == 1) {\r\n\t\t\tif(RegistrationModel::sendVerificationEmail($user_id, $new_user_email, $user_activation_hash, true)){\r\n                LoginModel::logout();\r\n                Redirect::home();\r\n\t\t\t}\r\n        }\r\n        return false;\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/panique/huge/issues/comments/147234456","html_url":"https://github.com/panique/huge/issues/705#issuecomment-147234456","issue_url":"https://api.github.com/repos/panique/huge/issues/705","id":147234456,"user":{"login":"panique","id":156321,"avatar_url":"https://avatars.githubusercontent.com/u/156321?v=3","gravatar_id":"","url":"https://api.github.com/users/panique","html_url":"https://github.com/panique","followers_url":"https://api.github.com/users/panique/followers","following_url":"https://api.github.com/users/panique/following{/other_user}","gists_url":"https://api.github.com/users/panique/gists{/gist_id}","starred_url":"https://api.github.com/users/panique/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panique/subscriptions","organizations_url":"https://api.github.com/users/panique/orgs","repos_url":"https://api.github.com/users/panique/repos","events_url":"https://api.github.com/users/panique/events{/privacy}","received_events_url":"https://api.github.com/users/panique/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T18:46:17Z","updated_at":"2015-10-11T18:46:17Z","body":"Btw if the user really mis-spelled the email adress then it's still possible to login with username."}}