diff --git a/apps/user_openid/appinfo/app.php b/apps/user_openid/appinfo/app.php index f2d5313c7e..93b178ac70 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 0000000000..021fe35d8e --- /dev/null +++ b/settings/ajax/openid.php @@ -0,0 +1,26 @@ + "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 a37ae7e6ea..8b970a13c5 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 010225bcb2..e6ca30d0ce 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 761289acef..819b71c894 100644 --- a/settings/templates/index.php +++ b/settings/templates/index.php @@ -29,6 +29,17 @@ + +
+
+ t( 'OpenID' );?> +

OpenID identity for

+

'>

+

+
+
+ +
t( 'Language' );?>