Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

term::login() doesn't work with term::push() #980

Open
jcubic opened this issue Oct 26, 2024 · 0 comments
Open

term::login() doesn't work with term::push() #980

jcubic opened this issue Oct 26, 2024 · 0 comments
Labels
Bug resolved if issue is resolved, it will be open until merge with master

Comments

@jcubic
Copy link
Owner

jcubic commented Oct 26, 2024

terminal::login() is documented but it don't work quite right.

Login only works when used in terminal option or with push(). But it should also work when called implicitly after the push().

const term = $('body').terminal({
    auth() {
        term.push(command => {
            term.echo(`protected command <white>${command}</white>`);
        }, {
            prompt: '# '
        }).login(function(username, password) {
            if (username == 'demo' && password == 'demo') {
                return '<TOKEN>';
            }
            return null;
        });
    }
}, {
    completion: true,
    prompt: '$ '
});

This doesn't work when user is already authenticated.

Steps to reproduce

  1. Open repro
  2. type auth and demo:demo as login and password
  3. refresh the page
  4. type auth

Actual behavior

The terminal is paused, when you press CTRL+D you're logged in.

@jcubic jcubic added the Bug label Oct 26, 2024
@jcubic jcubic added the resolved if issue is resolved, it will be open until merge with master label Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug resolved if issue is resolved, it will be open until merge with master
Projects
None yet
Development

No branches or pull requests

1 participant