Feature: logout
This commit is contained in:
parent
d3180809fc
commit
a93e46e606
3 changed files with 38 additions and 10 deletions
|
@ -1,12 +1,28 @@
|
|||
<div class="container">
|
||||
<h2>Login with your account</h2>
|
||||
<p>In order to enable the landing page and other features, you will have to login.
|
||||
<p>
|
||||
In order to enable the landing page and other features, you will have to
|
||||
login.
|
||||
</p>
|
||||
<p>
|
||||
You can only login using your account's cookie, check out
|
||||
<a
|
||||
href="https://codeberg.org/VnPower/pixivfe/wiki/How-to-get-the-cookie-%28PIXIVFE_TOKEN%29"
|
||||
>this page</a
|
||||
>
|
||||
to see how to get it.
|
||||
</p>
|
||||
<p>You can only login using your account's cookie, check out <a
|
||||
href="https://codeberg.org/VnPower/pixivfe/wiki/How-to-get-the-cookie-%28PIXIVFE_TOKEN%29">this page</a> to
|
||||
see how to get it.</p>
|
||||
<form action="/settings/token" method="post">
|
||||
<input type="text" name="token" autocomplete="off" />
|
||||
<input type="submit" value="Apply" />
|
||||
</form>
|
||||
<hr />
|
||||
<h2>Logout</h2>
|
||||
<p>
|
||||
You can safely logout here. This button will just delete the token directly
|
||||
from this session.
|
||||
</p>
|
||||
<form action="/settings/logout" method="post">
|
||||
<input type="submit" value="Logout!" />
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -299,6 +299,8 @@ func settings_post(c *fiber.Ctx) error {
|
|||
error = set_image_server(c)
|
||||
case "token":
|
||||
error = set_token(c)
|
||||
case "logout":
|
||||
error = set_logout(c)
|
||||
default:
|
||||
error = "No method available"
|
||||
}
|
||||
|
|
|
@ -96,3 +96,13 @@ func set_image_server(c *fiber.Ctx) string {
|
|||
}
|
||||
return "Empty form"
|
||||
}
|
||||
|
||||
func set_logout(c *fiber.Ctx) string {
|
||||
name := "token"
|
||||
sess := get_storage(c)
|
||||
|
||||
sess.Delete(name)
|
||||
save_storage(sess)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue