aboutsummaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2023-10-02 06:44:26 +0000
committerr <r@freesoftwareextremist.com>2023-10-02 06:44:26 +0000
commitb83a00aa2cdabfc20c162379c885caac0110e167 (patch)
treee212d216b794374624bef4d241038a763066a250 /service
parentdf031d5eddc3dc581e228bfcd9a327b9f169cdd5 (diff)
downloadbloat-b83a00aa2cdabfc20c162379c885caac0110e167.tar.gz
bloat-b83a00aa2cdabfc20c162379c885caac0110e167.zip
Revoke oauth token on signout
Diffstat (limited to 'service')
-rw-r--r--service/service.go4
-rw-r--r--service/transport.go4
2 files changed, 8 insertions, 0 deletions
diff --git a/service/service.go b/service/service.go
index 7043310..6b8d0ee 100644
--- a/service/service.go
+++ b/service/service.go
@@ -902,6 +902,10 @@ func (s *service) Signin(c *client, code string) (err error) {
return c.setSession(c.s)
}
+func (s *service) Signout(c *client) (err error) {
+ return c.RevokeToken(c.ctx)
+}
+
func (s *service) Post(c *client, content string, replyToID string,
format string, visibility string, isNSFW bool,
files []*multipart.FileHeader) (id string, err error) {
diff --git a/service/transport.go b/service/transport.go
index 69d08e2..1182d6c 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -676,6 +676,10 @@ func NewHandler(s *service, verbose bool, staticDir string) http.Handler {
}, CSRF, HTML)
signout := handle(func(c *client) error {
+ err := s.Signout(c)
+ if err != nil {
+ return err
+ }
c.unsetSession()
c.redirect("/")
return nil