Mirror of Quill
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.2 KiB

  1. <div class="narrow">
  2. <?= partial('partials/header') ?>
  3. <h2>Signed In As</h2>
  4. <code><?= session('me') ?></code>
  5. <h3>Access Token</h3>
  6. <input type="text" class="form-control" readonly="readonly" value="<?= $this->user->micropub_access_token ?>">
  7. <h3>Twitter</h3>
  8. <p>Connecting a Twitter account will automatically "favorite" tweets on Twitter when you favorite a Twitter URL in Quill.</p>
  9. <input type="button" id="twitter-button" value="Checking" class="btn">
  10. </div>
  11. <script>
  12. $(function(){
  13. $.getJSON("/auth/twitter", function(data){
  14. // Check if we're already authorized with twitter
  15. if(data && data.result == 'ok') {
  16. $("#twitter-button").val("Connected").addClass("btn-success");
  17. } else if(data && data.url) {
  18. $("#twitter-button").val("Sign In").data("url", data.url).addClass("btn-warning");
  19. } else {
  20. $("#twitter-button").val("Error").addClass("btn-danger");
  21. }
  22. });
  23. $("#twitter-button").click(function(){
  24. if($(this).data('url')) {
  25. window.location = $(this).data('url');
  26. } else {
  27. $.getJSON("/auth/twitter", {login: 1}, function(data){
  28. window.location = data.url;
  29. });
  30. }
  31. });
  32. });
  33. </script>