public void RefreshApiKey()
{
//_events.Publish(new Notification { Title = "Authorization failed", Message = "Your API Key has probably expired. You will be directed to a page where you can renew it", Level = TraceLevel.Error });
-
+ if (CurrentAccount == null)
+ return;
try
{
- var name = CurrentAccount != null ? CurrentAccount.AccountName : null;
- var credentials = PithosAccount.RetrieveCredentials(Settings.PithosLoginUrl,name);
+ var name = CurrentAccount.AccountName;
+
+ var loginUri = new Uri(new Uri(CurrentAccount.ServerUrl), "login");
+ var credentials = PithosAccount.RetrieveCredentials(loginUri.ToString(),name);
if (credentials==null)
return;
//The server will return credentials for a different account, not just the current account
//We need to find the correct account first
- var account = Accounts.First(act => act.AccountName == credentials.UserName);
+ var account = Accounts.First(act => act.AccountName == credentials.UserName && act.ServerUrl == ?? );
account.ApiKey = credentials.Password;
account.IsExpired = false;
Settings.Save();
actualRootPath = String.Format("{0} {1}", initialRootPath, attempt++);
}
}
+ ### Check that the account does not already exist
var newAccount = new AccountSettings
{
}
+/*
public void AddPithosAccount()
{
- var credentials=PithosAccount.RetrieveCredentials(Settings.PithosLoginUrl);
+ var credentials=PithosAccount.RetrieveCredentials(null);
if (credentials == null)
return;
var account = Settings.Accounts.FirstOrDefault(act => act.AccountName == credentials.UserName);
NotifyOfPropertyChange(() => Accounts);
NotifyOfPropertyChange(()=>Settings);
}
+*/
readonly List<AccountSettings> _accountsToRemove = new List<AccountSettings>();
SearchOption.AllDirectories))
File.Copy(newFilePath, newFilePath.Replace(oldPath, newPath));
+ Log.InfoFormat("Deleting account folder {0}",oldPath);
Directory.Delete(oldPath, true);
//We also need to change the path of the existing file states