Browse Source

reset micropub config data

pull/108/head
Aaron Parecki 6 years ago
parent
commit
89644bc435
No known key found for this signature in database GPG Key ID: 276C2817346D6056
2 changed files with 8 additions and 3 deletions
  1. +2
    -0
      controllers/auth.php
  2. +6
    -3
      lib/helpers.php

+ 2
- 0
controllers/auth.php View File

@ -291,6 +291,8 @@ $app->post('/auth/reset', function() use($app) {
$user->micropub_media_endpoint = ''; $user->micropub_media_endpoint = '';
$user->micropub_scope = ''; $user->micropub_scope = '';
$user->micropub_access_token = ''; $user->micropub_access_token = '';
$user->syndication_targets = '';
$user->supported_post_types = '';
$user->save(); $user->save();
unset($_SESSION['auth']); unset($_SESSION['auth']);

+ 6
- 3
lib/helpers.php View File

@ -284,6 +284,11 @@ function get_micropub_config(&$user, $query=[]) {
} }
} }
// Reset the values so they can be overwritten
$user->syndication_targets = '';
$user->supported_post_types = '';
$user->micropub_media_endpoint = '';
if(count($targets)) if(count($targets))
$user->syndication_targets = json_encode($targets); $user->syndication_targets = json_encode($targets);
@ -300,9 +305,7 @@ function get_micropub_config(&$user, $query=[]) {
} }
} }
if(count($targets) || $media_endpoint || $supported_post_types) {
$user->save();
}
$user->save();
return [ return [
'targets' => $targets, 'targets' => $targets,

Loading…
Cancel
Save