fix(submit): clear cached credentials on login failure
Problem: bad credentials were saved to cache before validation, so subsequent `:CP submit` calls silently reused them instead of re-prompting the user. Solution: match `"Login failed"` in the submit error callback and call `cache.clear_credentials()` so the next attempt re-prompts.
This commit is contained in:
parent
86b3eb9582
commit
df934efb19
1 changed files with 5 additions and 4 deletions
|
|
@ -75,10 +75,11 @@ function M.submit(opts)
|
|||
if result and result.success then
|
||||
logger.log('Submitted successfully', { level = vim.log.levels.INFO, override = true })
|
||||
else
|
||||
logger.log(
|
||||
'Submit failed: ' .. (result and result.error or 'unknown error'),
|
||||
{ level = vim.log.levels.ERROR }
|
||||
)
|
||||
local err = result and result.error or 'unknown error'
|
||||
if err:match('^Login failed') then
|
||||
cache.clear_credentials(platform)
|
||||
end
|
||||
logger.log('Submit failed: ' .. err, { level = vim.log.levels.ERROR })
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue