Mercurial > cgi-bin > hgweb.cgi > PassMan
diff src/main/kotlin/name/blackcap/passman/Entry.kt @ 2:3c792ad36b3d
Can now update a password and read it back.
author | David Barts <n5jrn@me.com> |
---|---|
date | Sun, 11 Sep 2022 18:24:55 -0700 |
parents | a6cfdffcaa94 |
children | ad997df1f560 |
line wrap: on
line diff
--- a/src/main/kotlin/name/blackcap/passman/Entry.kt Sun Sep 11 16:12:47 2022 -0700 +++ b/src/main/kotlin/name/blackcap/passman/Entry.kt Sun Sep 11 18:24:55 2022 -0700 @@ -17,18 +17,22 @@ ) fun withGeneratedPassword(length: Int, allowSymbols: Boolean, verbose: Boolean): Entry { - val generated = generate(length, allowSymbols) - if (verbose) { - println("Generated password: $generated") - } return Entry( name = _getName(), username = _getUsername(), - password = generated, + password = _genPassword(length, allowSymbols, verbose), notes = _getNotes() ) } + private fun _genPassword(length: Int, allowSymbols: Boolean, verbose: Boolean): CharArray { + val generated = generate(length, allowSymbols) + if (verbose) { + printPassword(generated) + } + return generated + } + private fun _getName() = mustReadLine("Name of site: ") private fun _getUsername() = mustReadLine("Username: ")