Persist login cookies for seamless password login restart
All checks were successful
Build plugin / build (push) Successful in 1m8s

This commit is contained in:
Jose Falanga 2026-08-17 02:04:00 -03:00
parent e2a4464d0d
commit 2b07195789
3 changed files with 112 additions and 15 deletions

View file

@ -100,6 +100,8 @@ func _on_save_button() -> void:
if method == 0:
# API key login
settings_manager.set_value("plugin.itch", "cookie", "")
settings_manager.set_value("plugin.itch", "username", "")
var api_key: String = api_key_box.text.strip_edges()
settings_manager.set_value("plugin.itch", "api_key", api_key)
if api_key == "":
@ -107,12 +109,13 @@ func _on_save_button() -> void:
itch.login_with_api_key(api_key)
else:
# Username/password login
var username: String = username_box.text.strip_edges()
var uname: String = username_box.text.strip_edges()
var password: String = password_box.text
settings_manager.set_value("plugin.itch", "username", username)
if username == "" or password == "":
settings_manager.set_value("plugin.itch", "username", uname)
settings_manager.set_value("plugin.itch", "cookie", "")
if uname == "" or password == "":
return
itch.login_with_password(username, password)
itch.login_with_password(uname, password)
## Fetches the user's collections and builds a checkbox for each one.