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
|
@ -156,10 +156,10 @@ getAddSshR :: Handler Html
|
|||
getAddSshR = postAddSshR
|
||||
postAddSshR :: Handler Html
|
||||
postAddSshR = sshConfigurator $ do
|
||||
username <- liftIO $ T.pack <$> myUserName
|
||||
username <- liftIO $ either (const Nothing) (Just . T.pack) <$> myUserName
|
||||
((result, form), enctype) <- liftH $
|
||||
runFormPostNoToken $ renderBootstrap3 bootstrapFormLayout $ sshInputAForm textField $
|
||||
SshInput Nothing (Just username) Password Nothing Nothing 22
|
||||
SshInput Nothing username Password Nothing Nothing 22
|
||||
case result of
|
||||
FormSuccess sshinput -> do
|
||||
s <- liftAssistant $ testServer sshinput
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue