also avoid crashing in most circumstances if unable to determine the username
Mostly the username is only used for the git committer or other display purposes, and we can just fall back to a dummy value in these cases. The only remaining place where an error is thrown is when starting local pairing, which needs the username to be known.
This commit is contained in:
parent
a3ff99ea3b
commit
8e4cbefbc6
6 changed files with 20 additions and 22 deletions
|
@ -226,7 +226,7 @@ startLocalPairing stage oncancel alert muuid displaysecret secret = do
|
|||
let pubkey = either error id $ validateSshPubKey $ sshPubKey keypair
|
||||
pairdata <- liftIO $ PairData
|
||||
<$> getHostname
|
||||
<*> myUserName
|
||||
<*> (either error id <$> myUserName)
|
||||
<*> pure reldir
|
||||
<*> pure pubkey
|
||||
<*> (maybe genUUID return muuid)
|
||||
|
@ -291,8 +291,8 @@ promptSecret msg cont = pairPage $ do
|
|||
let (username, hostname) = maybe ("", "")
|
||||
(\(_, v, a) -> (T.pack $ remoteUserName v, T.pack $ fromMaybe (showAddr a) (remoteHostName v)))
|
||||
(verifiableVal . fromPairMsg <$> msg)
|
||||
u <- T.pack <$> liftIO myUserName
|
||||
let sameusername = username == u
|
||||
u <- liftIO myUserName
|
||||
let sameusername = Right username == (T.pack <$> u)
|
||||
$(widgetFile "configurators/pairing/local/prompt")
|
||||
|
||||
{- This counts unicode characters as more than one character,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue