move openid settings to Personal

This commit is contained in:
Robin Appelman 2011-08-05 16:05:58 +02:00
parent c998bc1215
commit f039320a0b
5 changed files with 54 additions and 3 deletions

View File

@ -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');

26
settings/ajax/openid.php Normal file
View File

@ -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") )));
}
?>

View File

@ -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();
?>

View File

@ -19,6 +19,17 @@ $(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();

View File

@ -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>