Mercurial > cgi-bin > hgweb.cgi > PassMan
comparison 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 |
comparison
equal
deleted
inserted
replaced
1:8aacca5c2d53 | 2:3c792ad36b3d |
---|---|
15 password = _getPassword(), | 15 password = _getPassword(), |
16 notes = _getNotes() | 16 notes = _getNotes() |
17 ) | 17 ) |
18 | 18 |
19 fun withGeneratedPassword(length: Int, allowSymbols: Boolean, verbose: Boolean): Entry { | 19 fun withGeneratedPassword(length: Int, allowSymbols: Boolean, verbose: Boolean): Entry { |
20 val generated = generate(length, allowSymbols) | |
21 if (verbose) { | |
22 println("Generated password: $generated") | |
23 } | |
24 return Entry( | 20 return Entry( |
25 name = _getName(), | 21 name = _getName(), |
26 username = _getUsername(), | 22 username = _getUsername(), |
27 password = generated, | 23 password = _genPassword(length, allowSymbols, verbose), |
28 notes = _getNotes() | 24 notes = _getNotes() |
29 ) | 25 ) |
26 } | |
27 | |
28 private fun _genPassword(length: Int, allowSymbols: Boolean, verbose: Boolean): CharArray { | |
29 val generated = generate(length, allowSymbols) | |
30 if (verbose) { | |
31 printPassword(generated) | |
32 } | |
33 return generated | |
30 } | 34 } |
31 | 35 |
32 private fun _getName() = mustReadLine("Name of site: ") | 36 private fun _getName() = mustReadLine("Name of site: ") |
33 | 37 |
34 private fun _getUsername() = mustReadLine("Username: ") | 38 private fun _getUsername() = mustReadLine("Username: ") |