mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 16:25:53 +08:00
PrinterWebViewPanel: proper credentials/sent state clearing
This commit is contained in:
parent
a4dbe04ff0
commit
f46916681b
@ -224,8 +224,21 @@ public:
|
||||
|
||||
void send_api_key();
|
||||
void send_credentials();
|
||||
void set_api_key(const std::string& key) { m_api_key = key; m_usr.clear(); m_psk.clear(); }
|
||||
void set_credentials(const std::string& usr, const std::string& psk) { m_usr = usr; m_psk = psk; m_api_key.clear(); }
|
||||
void set_api_key(const std::string &key)
|
||||
{
|
||||
if (m_api_key != key) {
|
||||
clear();
|
||||
m_api_key = key;
|
||||
}
|
||||
}
|
||||
void set_credentials(const std::string &usr, const std::string &psk)
|
||||
{
|
||||
if (m_usr != usr || m_psk != psk) {
|
||||
clear();
|
||||
m_usr = usr;
|
||||
m_psk = psk;
|
||||
}
|
||||
}
|
||||
void clear() { m_api_key.clear(); m_usr.clear(); m_psk.clear(); m_api_key_sent = false; }
|
||||
void sys_color_changed() override;
|
||||
private:
|
||||
|
@ -14,7 +14,7 @@ struct Credentials {
|
||||
gboolean webkit_authorize_handler(WebKitWebView *web_view, WebKitAuthenticationRequest *request, gpointer user_data)
|
||||
{
|
||||
const Credentials& creds = *static_cast<const Credentials*>(user_data);
|
||||
webkit_authentication_request_authenticate(request, webkit_credential_new(creds.username.c_str(), creds.password.c_str(), WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION));
|
||||
webkit_authentication_request_authenticate(request, webkit_credential_new(creds.username.c_str(), creds.password.c_str(), WEBKIT_CREDENTIAL_PERSISTENCE_PERMANENT));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user