fix(codechef): fast bad-credentials detection and prompt prefix
Replace `wait_for_url` with `wait_for_function` in both login and submit `login_action` callbacks, racing URL change against `div.error` appearing — same pattern as AtCoder and Codeforces. Also prefix credential prompts with `[cp.nvim]:` for consistency.
This commit is contained in:
parent
0ad7a9614f
commit
f63b72788c
2 changed files with 12 additions and 8 deletions
|
|
@ -15,13 +15,13 @@ local STATUS_MESSAGES = {
|
|||
---@param platform string
|
||||
---@param display string
|
||||
local function prompt_and_login(platform, display)
|
||||
vim.ui.input({ prompt = display .. ' username: ' }, function(username)
|
||||
vim.ui.input({ prompt = '[cp.nvim]: ' .. display .. ' username: ' }, function(username)
|
||||
if not username or username == '' then
|
||||
logger.log('Cancelled', { level = vim.log.levels.WARN })
|
||||
return
|
||||
end
|
||||
vim.fn.inputsave()
|
||||
local password = vim.fn.inputsecret(display .. ' password: ')
|
||||
local password = vim.fn.inputsecret('[cp.nvim]: ' .. display .. ' password: ')
|
||||
vim.fn.inputrestore()
|
||||
if not password or password == '' then
|
||||
logger.log('Cancelled', { level = vim.log.levels.WARN })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue