summaryrefslogtreecommitdiff
path: root/app/Controller/User.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-07-16 20:35:56 -0400
committerFrederic Guillot <fred@kanboard.net>2015-07-16 20:35:56 -0400
commitede1f1d9b0c06a05845f4125d59c97c29b6d9842 (patch)
tree2fc9f21c586501d43440dace17e71bfb40618bfc /app/Controller/User.php
parent12036aa21f4308aca4d816864b357f9627a0f437 (diff)
Refactoring of Github authentication (oauth url change)
Diffstat (limited to 'app/Controller/User.php')
-rw-r--r--app/Controller/User.php65
1 files changed, 0 insertions, 65 deletions
diff --git a/app/Controller/User.php b/app/Controller/User.php
index 7a17d98e..946373ef 100644
--- a/app/Controller/User.php
+++ b/app/Controller/User.php
@@ -360,69 +360,4 @@ class User extends Base
'user' => $user,
)));
}
-
- /**
- * GitHub authentication
- *
- * @access public
- */
- public function github()
- {
- $code = $this->request->getStringParam('code');
-
- if ($code) {
- $profile = $this->authentication->backend('gitHub')->getGitHubProfile($code);
-
- if (is_array($profile)) {
-
- // If the user is already logged, link the account otherwise authenticate
- if ($this->userSession->isLogged()) {
-
- if ($this->authentication->backend('gitHub')->updateUser($this->userSession->getId(), $profile)) {
- $this->session->flash(t('Your GitHub account was successfully linked to your profile.'));
- }
- else {
- $this->session->flashError(t('Unable to link your GitHub Account.'));
- }
-
- $this->response->redirect($this->helper->url->to('user', 'external', array('user_id' => $this->userSession->getId())));
- }
- else if ($this->authentication->backend('gitHub')->authenticate($profile['id'])) {
- $this->response->redirect($this->helper->url->to('app', 'index'));
- }
- else {
- $this->response->html($this->template->layout('auth/index', array(
- 'errors' => array('login' => t('GitHub authentication failed')),
- 'values' => array(),
- 'no_layout' => true,
- 'redirect_query' => '',
- 'title' => t('Login')
- )));
- }
- }
- }
-
- $this->response->redirect($this->authentication->backend('gitHub')->getAuthorizationUrl());
- }
-
- /**
- * Unlink a GitHub account
- *
- * @access public
- */
- public function unlinkGithub()
- {
- $this->checkCSRFParam();
-
- $this->authentication->backend('gitHub')->revokeGitHubAccess();
-
- if ($this->authentication->backend('gitHub')->unlink($this->userSession->getId())) {
- $this->session->flash(t('Your GitHub account is no longer linked to your profile.'));
- }
- else {
- $this->session->flashError(t('Unable to unlink your GitHub Account.'));
- }
-
- $this->response->redirect($this->helper->url->to('user', 'external', array('user_id' => $this->userSession->getId())));
- }
}