~vierbergenlars/remotecp-panel/trunk

« back to all changes in this revision

Viewing changes to openid/link_account.php

  • Committer: Lars Vierbergen
  • Date: 2011-09-06 16:33:44 UTC
  • mfrom: (160.1.8 openid)
  • Revision ID: lars_vierbergen-20110906163344-cp20gr6vkslzoydm
Merge the OpenId branch, adding OpenID RP support

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
define('NO_UURL',true);
 
3
define('__DEBUG__',true);
 
4
$identity='';
 
5
$attributes=array();
 
6
chdir(__DIR__.'/..'); // Our root is at the parent directory!
 
7
require 'inc/controllers.php';
 
8
if($_SESSION['auth_type']!='openid') {
 
9
        JSError::add('You need an OpenID to link to your account.');
 
10
}
 
11
if(session::isBoundOpenId(sha1($_SESSION['openid']['identity']))) {
 
12
        JSError::add('This OpenID is already bound.');
 
13
}
 
14
if(JSError::count()>0) {
 
15
        echo JSError::show();
 
16
        exit;
 
17
}
 
18
$_SESSION['openid_link_id']=$_SESSION['openid']['identity'];
 
19
if(!isset($_POST['user'])) {
 
20
        echo 'Now just log in to your account, this OpenID will be bound.';
 
21
/*      echo '<form action="" method="POST">';
 
22
        echo '<label>'.$t->_('Username').': <input type="text" name="user"></label><br>';
 
23
        echo '<label>'.$t->_('Password').': <input type="password" name="pass"><br>';
 
24
        echo '<input type="submit">';
 
25
        echo '</form>';
 
26
}
 
27
/*else {
 
28
        if(session::login($_POST['user'], $_POST['pass'])) {
 
29
                session::$guid=session::getGUID($_POST['user']);
 
30
                if(session::bindOpenID(session::$guid, sha1($_SESSION['openid']['identity']))) {
 
31
                        echo "OpenID bound to your account";
 
32
                }
 
33
                else {
 
34
                        echo "Error binding OpenID";
 
35
                }
 
36
        }
 
37
        else {
 
38
                echo "Login failure";
 
39
        }*/
 
40
}