Remove plain-text credential store

librespot stores a more secure token that is valid for a while, rely on this
instead.

On the flip side this requires users to re-enter their login data when their
token has expired.

If the token validity is too short we will have to come up with another
approach, e.g. OS keyrings.

fixes #447
This commit is contained in:
Henrik Friedrichsen
2021-03-05 23:47:12 +01:00
parent f2bcfcaa60
commit d6db7a54d6
2 changed files with 6 additions and 36 deletions

View File

@@ -1,5 +1,3 @@
use std::path::Path;
use cursive::traits::Boxable;
use cursive::view::Identifiable;
use cursive::views::*;
@@ -8,13 +6,9 @@ use cursive::{CbSink, Cursive, CursiveExt};
use librespot_core::authentication::Credentials as RespotCredentials;
use librespot_protocol::authentication::AuthenticationType;
pub fn create_credentials(path: &Path) -> Result<RespotCredentials, String> {
pub fn create_credentials() -> Result<RespotCredentials, String> {
let mut login_cursive = Cursive::default();
let info_buf = TextContent::new("Failed to authenticate\n");
info_buf.append(format!(
"Cannot read config file from {}\n",
path.to_str().unwrap()
));
let info_buf = TextContent::new("Please login to Spotify\n");
let info_view = Dialog::around(TextView::new_with_content(info_buf))
.button("Login", move |s| {
let login_view = Dialog::new()