forked from friendica/friendica-addons
Diaspora: Check for credentials in the setup.
This commit is contained in:
parent
21f3adb911
commit
e28b559bfc
|
@ -128,6 +128,18 @@ function diaspora_settings(&$a,&$s) {
|
|||
$diaspora_password = get_pconfig(local_user(), 'diaspora', 'diaspora_password');
|
||||
$diaspora_url = get_pconfig(local_user(), 'diaspora', 'diaspora_url');
|
||||
|
||||
$status = "";
|
||||
|
||||
if ($diaspora_username AND $diaspora_password AND $diaspora_url) {
|
||||
try {
|
||||
require_once("addon/diaspora/diasphp.php");
|
||||
|
||||
$conn = new Diasphp($diaspora_url);
|
||||
$conn->login($diaspora_username, $diaspora_password);
|
||||
} catch (Exception $e) {
|
||||
$status = t("Can't login to your Diaspora account. Please check username and password and ensure you used the complete address (including http...)");
|
||||
}
|
||||
}
|
||||
|
||||
/* Add some HTML to the existing form */
|
||||
|
||||
|
@ -139,6 +151,12 @@ function diaspora_settings(&$a,&$s) {
|
|||
$s .= '<h3>' . t('Diaspora') . '</h3>';
|
||||
$s .= '</span>';
|
||||
|
||||
if ($status) {
|
||||
$s .= '<div id="diaspora-status-wrapper"><strong>';
|
||||
$s .= $status;
|
||||
$s .= '</strong></div><div class="clear"></div>';
|
||||
}
|
||||
|
||||
$s .= '<div id="diaspora-enable-wrapper">';
|
||||
$s .= '<label id="diaspora-enable-label" for="diaspora-checkbox">' . t('Enable Diaspora Post Plugin') . '</label>';
|
||||
$s .= '<input id="diaspora-checkbox" type="checkbox" name="diaspora" value="1" ' . $checked . '/>';
|
||||
|
|
Loading…
Reference in a new issue