summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/user_openid/appinfo/app.php2
-rw-r--r--settings/ajax/openid.php26
-rw-r--r--settings/index.php5
-rw-r--r--settings/js/main.js13
-rw-r--r--settings/templates/index.php11
5 files changed, 54 insertions, 3 deletions
diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php
index f2d5313c7e0..93b178ac706 100644
--- a/apps/user_openid/appinfo/app.php
+++ b/apps/user_openid/appinfo/app.php
@@ -21,8 +21,6 @@ OC_Util::addHeader('link',array('rel'=>'openid.delegate', 'href'=>$urlBase.OC_He
require_once 'apps/user_openid/user_openid.php';
-OC_App::addSettingsPage( array( "id" => "user_openid_settings", 'order'=>1, "href" => OC_Helper::linkTo( "user_openid", "settings.php" ), "name" => "OpenID"));
-
//active the openid backend
OC_User::useBackend('openid');
diff --git a/settings/ajax/openid.php b/settings/ajax/openid.php
new file mode 100644
index 00000000000..021fe35d8ec
--- /dev/null
+++ b/settings/ajax/openid.php
@@ -0,0 +1,26 @@
+<?php
+
+// Init owncloud
+require_once('../../lib/base.php');
+
+$l=new OC_L10N('settings');
+
+// We send json data
+header( "Content-Type: application/jsonrequest" );
+
+// Check if we are a user
+if( !OC_User::isLoggedIn()){
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Authentication error") )));
+ exit();
+}
+
+// Get data
+if( isset( $_POST['identity'] ) ){
+ $identity=$_POST['identity'];
+ OC_Preferences::setValue(OC_User::getUser(),'user_openid','identity',$identity);
+ echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("OpenID Changed") )));
+}else{
+ echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") )));
+}
+
+?>
diff --git a/settings/index.php b/settings/index.php
index a37ae7e6ea2..8b970a13c58 100644
--- a/settings/index.php
+++ b/settings/index.php
@@ -29,6 +29,11 @@ $tmpl->assign('usage',OC_Helper::humanFileSize($used));
$tmpl->assign('total_space',OC_Helper::humanFileSize($total));
$tmpl->assign('usage_relative',$relative);
$tmpl->assign('languages',$languages);
+$tmpl->assign('hasopenid',OC_App::isEnabled( 'user_openid' ));
+if(OC_App::isEnabled( 'user_openid' )){
+ $identity=OC_Preferences::getValue(OC_User::getUser(),'user_openid','identity','');
+ $tmpl->assign('identity',$identity);
+}
$tmpl->printPage();
?>
diff --git a/settings/js/main.js b/settings/js/main.js
index 010225bcb27..e6ca30d0ce4 100644
--- a/settings/js/main.js
+++ b/settings/js/main.js
@@ -18,7 +18,18 @@ $(document).ready(function(){
});
return false;
});
-
+
+ $('#openidform').submit(function(event){
+ event.preventDefault();
+ var post = $( "#openidform" ).serialize();
+ $.post( 'ajax/openid.php', post, function(data){
+ if( data.status == "success" ){
+ }else{
+ alert('error while setting OpenID');
+ }
+ });
+ });
+
$("#languageinput").change( function(){
// Serialize the data
var post = $( "#languageinput" ).serialize();
diff --git a/settings/templates/index.php b/settings/templates/index.php
index 761289acefa..819b71c8943 100644
--- a/settings/templates/index.php
+++ b/settings/templates/index.php
@@ -29,6 +29,17 @@
</fieldset>
</form>
+<?php if($_['hasopenid']):?>
+ <form id="openidform">
+ <fieldset>
+ <legend><?php echo $l->t( 'OpenID' );?></legend>
+ <p>OpenID identity for <b><?php echo OC_User::getUser();?></b></p>
+ <p><input name='identity' id='identity' value='<?php echo $_['identity']; ?>'></input></p>
+ <p><input type='submit' value='Save'></input></p>
+ </fieldset>
+ </form>
+<?php endif;?>
+
<form id="languageform">
<fieldset>
<legend><?php echo $l->t( 'Language' );?></legend>