예제 #1
0
def add(ctx, email, password):
    user = User(Email=email)
    click.echo("""
    1. Open https://authorize.kobo.com/signin in a private/incognito window in your browser.
    2. wait till the page loads (do not login!)
    3. open the developer tools (use F12 in Firefox/Chrome, or right-click and choose "inspect")
    4. select the console tab,
    5. copy-paste the following code to the console there and then press Enter.

    var newCaptchaDiv = document.createElement("div");
    newCaptchaDiv.id = "new-hcaptcha-container";
    var siteKey = document.getElementById('hcaptcha-container').getAttribute('data-sitekey');
    document.body.replaceChildren(newCaptchaDiv);
    grecaptcha.render(newCaptchaDiv.id, {
        sitekey: siteKey,
        callback: function(r) {console.log("Captcha response:");console.log(r);}
    });
    console.log('Click the checkbox to get the code');

    A captcha should show up below the Sign-in form. Once you solve the captcha its response will be written
    below the pasted code in the browser's console. Copy the response (the line below "Captcha response:")
    and paste it here.  It will be very long!
    """)
    input('Press enter after copying the captcha code...')
    captcha = pyperclip.paste().strip()
    click.echo(f'Read captcha code from clipboard: {captcha}')
    actions.Login(user, password, captcha)
    Globals.Settings.UserList.users.append(user)
    Globals.Settings.Save()
    click.echo('Login Success. Try to list your books with `kobodl book list`')
예제 #2
0
def add(ctx, email, password):
    user = User(Email=email)
    click.echo(
        """
    Open https://authorize.kobo.com/signin in a private/incognito window in your browser, wait till the page
    loads (do not login!) then open the developer tools (use F12 in Firefox/Chrome), select the console tab,
    and paste the following code there and then press Enter there in the browser.

    var newCaptchaDiv = document.createElement( "div" );
    newCaptchaDiv.id = "new-grecaptcha-container";
    document.getElementById( "grecaptcha-container" ).insertAdjacentElement( "afterend", newCaptchaDiv );
    grecaptcha.render( newCaptchaDiv.id, {
        sitekey: "6Le_Hc8ZAAAAAO6IMIG5zdDmANbljtXY4EHK0wzD",
        callback: function( response ) { console.log( "Captcha response:" ); console.log( response ); }
    } );

    A captcha should show up below the Sign-in form. Once you solve the captcha its response will be written
    below the pasted code in the browser's console. Copy the response (the line below "Captcha response:")
    and paste it here.
    """
    )
    captcha = input('Captcha response: ').strip()
    actions.Login(user, password, captcha)
    Globals.Settings.UserList.users.append(user)
    Globals.Settings.Save()
    click.echo('Login Success. Try to list your books with `kobodl book list`')
예제 #3
0
def users():
    error = None
    if request.method == 'POST':
        print(request.form)
        email = request.form.get('email')
        password = request.form.get('password')
        captcha = request.form.get('captcha')
        print(email, password, captcha)
        if email and password and captcha:
            user = User(Email=email)
            try:
                actions.Login(user, password, captcha)
                Globals.Settings.UserList.users.append(user)
                Globals.Settings.Save()
            except Exception as err:
                error = str(err)
        else:
            error = 'email, password, or captcha missing'
    users = Globals.Settings.UserList.users
    return render_template('users.j2', users=users, error=error)