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

Auth fails if the password ends with 6 numbers at the end #11

Open
deridiot opened this issue Jan 30, 2024 · 0 comments
Open

Auth fails if the password ends with 6 numbers at the end #11

deridiot opened this issue Jan 30, 2024 · 0 comments

Comments

@deridiot
Copy link

deridiot commented Jan 30, 2024

If a password incidentally has 6 numbers at the end the module will assume that those 6 numbers are an otp code and hence the login will fail.

I'm not sure what the best approach to this is. A global setting to block otp only fixes this if no user uses 2fa.
Maybe best would be to try to auth first with the code and afterwards with the full supplied string/password.

like so on main.go line 247+:

	if err != nil {
		if hasOtpInPassword {
			// we parsed the password and assumed the last 6 digits were an otp code... sadly they weren't
			// so let's try again with the full password
			accessToken, err = passwordCredentialsTokenEx(
				oauth2Context,
				oauth2Config,
				fmt.Sprintf(config.UsernameFormat, username),
				inputStdio,
				"",
				config.Scope,
				extraParameters,
			)
		}

		if err != nil {
			log.Print(sid, strings.ReplaceAll(err.Error(), "\n", ". "))
			os.Exit(2)
		}
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant