mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
logout
This commit is contained in:
parent
e8a002d535
commit
6a828532cb
@ -92,6 +92,9 @@
|
|||||||
body: new FormData(form),
|
body: new FormData(form),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
logout: function() {
|
||||||
|
return api('post', './logout')
|
||||||
|
},
|
||||||
crawl: function(url) {
|
crawl: function(url) {
|
||||||
return fetch('./page?url=' + url).then(function(res) {
|
return fetch('./page?url=' + url).then(function(res) {
|
||||||
return res.text()
|
return res.text()
|
||||||
|
@ -509,6 +509,11 @@ var vm = new Vue({
|
|||||||
vm.refreshStats()
|
vm.refreshStats()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
logout: function() {
|
||||||
|
api.logout().then(function() {
|
||||||
|
document.location.reload()
|
||||||
|
})
|
||||||
|
},
|
||||||
getReadable: function(item) {
|
getReadable: function(item) {
|
||||||
if (this.itemSelectedReadability) {
|
if (this.itemSelectedReadability) {
|
||||||
this.itemSelectedReadability = null
|
this.itemSelectedReadability = null
|
||||||
|
@ -39,6 +39,15 @@ func userAuthenticate(rw http.ResponseWriter, username, password string) {
|
|||||||
http.SetCookie(rw, &cookie)
|
http.SetCookie(rw, &cookie)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func userLogout(rw http.ResponseWriter) {
|
||||||
|
cookie := http.Cookie{
|
||||||
|
Name: "auth",
|
||||||
|
Value: "",
|
||||||
|
MaxAge: -1,
|
||||||
|
}
|
||||||
|
http.SetCookie(rw, &cookie)
|
||||||
|
}
|
||||||
|
|
||||||
func stringsEqual(p1, p2 string) bool {
|
func stringsEqual(p1, p2 string) bool {
|
||||||
return subtle.ConstantTimeCompare([]byte(p1), []byte(p2)) == 1
|
return subtle.ConstantTimeCompare([]byte(p1), []byte(p2)) == 1
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ var routes []Route = []Route{
|
|||||||
p("/opml/import", OPMLImportHandler),
|
p("/opml/import", OPMLImportHandler),
|
||||||
p("/opml/export", OPMLExportHandler),
|
p("/opml/export", OPMLExportHandler),
|
||||||
p("/page", PageCrawlHandler),
|
p("/page", PageCrawlHandler),
|
||||||
|
p("/logout", LogoutHandler),
|
||||||
}
|
}
|
||||||
|
|
||||||
type asset struct {
|
type asset struct {
|
||||||
@ -528,3 +529,8 @@ func PageCrawlHandler(rw http.ResponseWriter, req *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func LogoutHandler(rw http.ResponseWriter, req *http.Request) {
|
||||||
|
userLogout(rw)
|
||||||
|
rw.WriteHeader(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user