{"action":"created","comment":{"url":"https://api.github.com/repos/indico/indico/pulls/comments/29225258","id":29225258,"diff_hunk":"@@ -200,6 +205,60 @@ def _create_user(self, data, handler):\n         return handler.redirect_success()\n \n \n+class RHUserAccounts(RHUserBase):\n+    \"\"\"Displays user accounts\"\"\"\n+\n+    def _create_form(self):\n+        if self.user.local_identity:\n+            defaults = FormDefaults(username=self.user.local_identity.identifier)\n+            local_account_form = LocalLoginEditForm(identity=self.user.local_identity, obj=defaults)\n+        else:\n+            local_account_form = LocalLoginAddForm()\n+        return local_account_form\n+\n+    def _handle_add_local_account(self, form):\n+        identity = Identity(provider='indico', identifier=form.data['username'], password=form.data['password'])\n+        self.user.identities.add(identity)\n+        flash(_(\"Local account added successfully\"), 'success')\n+\n+    def _handle_edit_local_account(self, form):\n+        self.user.local_identity.identifier = form.data['username']\n+        self.user.local_identity.password = form.data['password']\n+        flash(_(\"Your local account credentials have been updated successfully\"), 'success')\n+\n+    def _process(self):\n+        form = self._create_form()\n+        if form.validate_on_submit():\n+            if isinstance(form, LocalLoginAddForm):\n+                self._handle_add_local_account(form)\n+            elif isinstance(form, LocalLoginEditForm):\n+                self._handle_edit_local_account(form)\n+            return redirect(url_for('auth.accounts'))\n+        provider_titles = {name: provider.title for name, provider in multipass.auth_providers.iteritems()}\n+        return WPUser.render_template('accounts.html', form=form, user=self.user, provider_titles=provider_titles)\n+\n+\n+class RHUserAccountsRemove(RHUserBase):\n+    \"\"\"Removes an account\"\"\"\n+\n+    def _checkParams(self):\n+        RHUserBase._checkParams(self)\n+        self.identity = Identity.get_one(request.view_args['identity'])\n+        if self.identity.user != self.user:\n+            raise Forbidden(\"This identity doesn't belong to the user\".format(self.identity.id))\n+\n+    def _process(self):\n+        if session['login_identity'] == self.identity.id:\n+            raise BadRequest(\"The identity used to log in can't be removed\")\n+        if self.user.local_identity == self.identity:\n+            raise BadRequest(\"The main local identity can't be removed\")\n+        self.user.identities.remove(self.identity)\n+        provider_title = multipass.identity_providers[self.identity.provider].title\n+        flash(_(\"Account {} ({}) successfully removed from your accounts\"\n+              .format(self.identity.identifier, provider_title)), 'success')\n+        return redirect(url_for('auth.accounts'))","path":"indico/modules/auth/controllers.py","position":79,"original_position":79,"commit_id":"86eb3d30e3bb547ce2c09588fb0d6dfe6a9e1675","original_commit_id":"86eb3d30e3bb547ce2c09588fb0d6dfe6a9e1675","user":{"login":"ThiefMaster","id":179599,"avatar_url":"https://avatars.githubusercontent.com/u/179599?v=3","gravatar_id":"","url":"https://api.github.com/users/ThiefMaster","html_url":"https://github.com/ThiefMaster","followers_url":"https://api.github.com/users/ThiefMaster/followers","following_url":"https://api.github.com/users/ThiefMaster/following{/other_user}","gists_url":"https://api.github.com/users/ThiefMaster/gists{/gist_id}","starred_url":"https://api.github.com/users/ThiefMaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThiefMaster/subscriptions","organizations_url":"https://api.github.com/users/ThiefMaster/orgs","repos_url":"https://api.github.com/users/ThiefMaster/repos","events_url":"https://api.github.com/users/ThiefMaster/events{/privacy}","received_events_url":"https://api.github.com/users/ThiefMaster/received_events","type":"User","site_admin":false},"body":"when the code is never called from another blueprint's request. so view functions and \"normal\" templates are fine, base-like templates aren't","created_at":"2015-04-28T09:09:06Z","updated_at":"2015-04-28T09:09:06Z","html_url":"https://github.com/indico/indico/pull/1856#discussion_r29225258","pull_request_url":"https://api.github.com/repos/indico/indico/pulls/1856","_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/comments/29225258"},"html":{"href":"https://github.com/indico/indico/pull/1856#discussion_r29225258"},"pull_request":{"href":"https://api.github.com/repos/indico/indico/pulls/1856"}}},"pull_request":{"url":"https://api.github.com/repos/indico/indico/pulls/1856","id":34167834,"html_url":"https://github.com/indico/indico/pull/1856","diff_url":"https://github.com/indico/indico/pull/1856.diff","patch_url":"https://github.com/indico/indico/pull/1856.patch","issue_url":"https://api.github.com/repos/indico/indico/issues/1856","number":1856,"state":"open","locked":false,"title":"Accounts page","user":{"login":"OmeGak","id":716307,"avatar_url":"https://avatars.githubusercontent.com/u/716307?v=3","gravatar_id":"","url":"https://api.github.com/users/OmeGak","html_url":"https://github.com/OmeGak","followers_url":"https://api.github.com/users/OmeGak/followers","following_url":"https://api.github.com/users/OmeGak/following{/other_user}","gists_url":"https://api.github.com/users/OmeGak/gists{/gist_id}","starred_url":"https://api.github.com/users/OmeGak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OmeGak/subscriptions","organizations_url":"https://api.github.com/users/OmeGak/orgs","repos_url":"https://api.github.com/users/OmeGak/repos","events_url":"https://api.github.com/users/OmeGak/events{/privacy}","received_events_url":"https://api.github.com/users/OmeGak/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-27T13:22:50Z","updated_at":"2015-04-28T09:09:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27e6845f2146a39c64a5916bce45eeb0996e8352","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/indico/indico/pulls/1856/commits","review_comments_url":"https://api.github.com/repos/indico/indico/pulls/1856/comments","review_comment_url":"https://api.github.com/repos/indico/indico/pulls/comments{/number}","comments_url":"https://api.github.com/repos/indico/indico/issues/1856/comments","statuses_url":"https://api.github.com/repos/indico/indico/statuses/86eb3d30e3bb547ce2c09588fb0d6dfe6a9e1675","head":{"label":"OmeGak:accounts-page","ref":"accounts-page","sha":"86eb3d30e3bb547ce2c09588fb0d6dfe6a9e1675","user":{"login":"OmeGak","id":716307,"avatar_url":"https://avatars.githubusercontent.com/u/716307?v=3","gravatar_id":"","url":"https://api.github.com/users/OmeGak","html_url":"https://github.com/OmeGak","followers_url":"https://api.github.com/users/OmeGak/followers","following_url":"https://api.github.com/users/OmeGak/following{/other_user}","gists_url":"https://api.github.com/users/OmeGak/gists{/gist_id}","starred_url":"https://api.github.com/users/OmeGak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OmeGak/subscriptions","organizations_url":"https://api.github.com/users/OmeGak/orgs","repos_url":"https://api.github.com/users/OmeGak/repos","events_url":"https://api.github.com/users/OmeGak/events{/privacy}","received_events_url":"https://api.github.com/users/OmeGak/received_events","type":"User","site_admin":false},"repo":{"id":9673156,"name":"indico","full_name":"OmeGak/indico","owner":{"login":"OmeGak","id":716307,"avatar_url":"https://avatars.githubusercontent.com/u/716307?v=3","gravatar_id":"","url":"https://api.github.com/users/OmeGak","html_url":"https://github.com/OmeGak","followers_url":"https://api.github.com/users/OmeGak/followers","following_url":"https://api.github.com/users/OmeGak/following{/other_user}","gists_url":"https://api.github.com/users/OmeGak/gists{/gist_id}","starred_url":"https://api.github.com/users/OmeGak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OmeGak/subscriptions","organizations_url":"https://api.github.com/users/OmeGak/orgs","repos_url":"https://api.github.com/users/OmeGak/repos","events_url":"https://api.github.com/users/OmeGak/events{/privacy}","received_events_url":"https://api.github.com/users/OmeGak/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OmeGak/indico","description":"The Indico Project","fork":true,"url":"https://api.github.com/repos/OmeGak/indico","forks_url":"https://api.github.com/repos/OmeGak/indico/forks","keys_url":"https://api.github.com/repos/OmeGak/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OmeGak/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OmeGak/indico/teams","hooks_url":"https://api.github.com/repos/OmeGak/indico/hooks","issue_events_url":"https://api.github.com/repos/OmeGak/indico/issues/events{/number}","events_url":"https://api.github.com/repos/OmeGak/indico/events","assignees_url":"https://api.github.com/repos/OmeGak/indico/assignees{/user}","branches_url":"https://api.github.com/repos/OmeGak/indico/branches{/branch}","tags_url":"https://api.github.com/repos/OmeGak/indico/tags","blobs_url":"https://api.github.com/repos/OmeGak/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OmeGak/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OmeGak/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/OmeGak/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OmeGak/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/OmeGak/indico/languages","stargazers_url":"https://api.github.com/repos/OmeGak/indico/stargazers","contributors_url":"https://api.github.com/repos/OmeGak/indico/contributors","subscribers_url":"https://api.github.com/repos/OmeGak/indico/subscribers","subscription_url":"https://api.github.com/repos/OmeGak/indico/subscription","commits_url":"https://api.github.com/repos/OmeGak/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/OmeGak/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/OmeGak/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/OmeGak/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/OmeGak/indico/contents/{+path}","compare_url":"https://api.github.com/repos/OmeGak/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OmeGak/indico/merges","archive_url":"https://api.github.com/repos/OmeGak/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OmeGak/indico/downloads","issues_url":"https://api.github.com/repos/OmeGak/indico/issues{/number}","pulls_url":"https://api.github.com/repos/OmeGak/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/OmeGak/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/OmeGak/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OmeGak/indico/labels{/name}","releases_url":"https://api.github.com/repos/OmeGak/indico/releases{/id}","created_at":"2013-04-25T14:05:57Z","updated_at":"2015-04-17T11:33:58Z","pushed_at":"2015-04-27T13:42:47Z","git_url":"git://github.com/OmeGak/indico.git","ssh_url":"git@github.com:OmeGak/indico.git","clone_url":"https://github.com/OmeGak/indico.git","svn_url":"https://github.com/OmeGak/indico","homepage":"http://indico-software.org","size":179936,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"indico:wip/new-auth-users","ref":"wip/new-auth-users","sha":"8a9212414b0a69370f190bd8e90cf532ddc47c98","user":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"repo":{"id":2113067,"name":"indico","full_name":"indico/indico","owner":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/indico/indico","description":"The Indico Project","fork":false,"url":"https://api.github.com/repos/indico/indico","forks_url":"https://api.github.com/repos/indico/indico/forks","keys_url":"https://api.github.com/repos/indico/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/indico/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/indico/indico/teams","hooks_url":"https://api.github.com/repos/indico/indico/hooks","issue_events_url":"https://api.github.com/repos/indico/indico/issues/events{/number}","events_url":"https://api.github.com/repos/indico/indico/events","assignees_url":"https://api.github.com/repos/indico/indico/assignees{/user}","branches_url":"https://api.github.com/repos/indico/indico/branches{/branch}","tags_url":"https://api.github.com/repos/indico/indico/tags","blobs_url":"https://api.github.com/repos/indico/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/indico/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/indico/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/indico/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/indico/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/indico/indico/languages","stargazers_url":"https://api.github.com/repos/indico/indico/stargazers","contributors_url":"https://api.github.com/repos/indico/indico/contributors","subscribers_url":"https://api.github.com/repos/indico/indico/subscribers","subscription_url":"https://api.github.com/repos/indico/indico/subscription","commits_url":"https://api.github.com/repos/indico/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/indico/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/indico/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/indico/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/indico/indico/contents/{+path}","compare_url":"https://api.github.com/repos/indico/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/indico/indico/merges","archive_url":"https://api.github.com/repos/indico/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/indico/indico/downloads","issues_url":"https://api.github.com/repos/indico/indico/issues{/number}","pulls_url":"https://api.github.com/repos/indico/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/indico/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/indico/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/indico/indico/labels{/name}","releases_url":"https://api.github.com/repos/indico/indico/releases{/id}","created_at":"2011-07-27T13:56:30Z","updated_at":"2015-04-28T07:36:59Z","pushed_at":"2015-04-28T08:22:34Z","git_url":"git://github.com/indico/indico.git","ssh_url":"git@github.com:indico/indico.git","clone_url":"https://github.com/indico/indico.git","svn_url":"https://github.com/indico/indico","homepage":"http://indico-software.org","size":199043,"stargazers_count":83,"watchers_count":83,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":489,"forks":49,"open_issues":489,"watchers":83,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/1856"},"html":{"href":"https://github.com/indico/indico/pull/1856"},"issue":{"href":"https://api.github.com/repos/indico/indico/issues/1856"},"comments":{"href":"https://api.github.com/repos/indico/indico/issues/1856/comments"},"review_comments":{"href":"https://api.github.com/repos/indico/indico/pulls/1856/comments"},"review_comment":{"href":"https://api.github.com/repos/indico/indico/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/indico/indico/pulls/1856/commits"},"statuses":{"href":"https://api.github.com/repos/indico/indico/statuses/86eb3d30e3bb547ce2c09588fb0d6dfe6a9e1675"}}}}