Exemplo n.º 1
0
 public function process()
 {
     $details = github_connect_details($this->config);
     if (!empty($details)) {
         $oauth2 = new Hm_Oauth2($details['client_id'], $details['client_secret'], $details['redirect_uri']);
         $this->out('github_auth_url', $oauth2->request_authorization_url($details['auth_url'], 'repo', 'github_authorization'));
         $this->out('github_connect_details', $this->user_config->get('github_connect_details', array()));
         $this->out('github_repos', $this->user_config->get('github_repos', array()));
     }
 }
Exemplo n.º 2
0
/**
 * @subpackage nux/functions
 */
function oauth2_form($details, $mod)
{
    $oauth2 = new Hm_Oauth2($details['client_id'], $details['client_secret'], $details['redirect_uri']);
    $url = $oauth2->request_authorization_url($details['auth_uri'], $details['scope'], 'nux_authorization', $details['email']);
    $res = '<input type="hidden" name="nux_service" value="' . $mod->html_safe($details['id']) . '" />';
    $res .= '<div class="nux_step_two_title">' . $mod->html_safe($details['name']) . '</div><div>';
    $res .= $mod->trans('This provider supports Oauth2 access to your account.');
    $res .= $mod->trans(' This is the most secure way to access your E-mail. Click "Enable" to be redirected to the provider site to allow access.');
    $res .= '</div><a class="enable_auth2" href="' . $url . '">' . $mod->trans('Enable') . '</a>';
    $res .= '<a href="" class="reset_nux_form">Reset</a>';
    return $res;
}