Use USER and HOME environment when set, and only fall back to getpwent, which doesn't work with LDAP or NIS.

This commit is contained in:
Joey Hess 2012-10-25 18:17:32 -04:00
parent 2018de53a3
commit 7ee0ffaeb9
13 changed files with 49 additions and 20 deletions

View file

@ -21,13 +21,13 @@ import Logs.Remote
import Remote
import Logs.PreferredContent
import Types.StandardGroups
import Utility.UserInfo
import Yesod
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Map as M
import Network.Socket
import System.Posix.User
sshConfigurator :: Widget -> Handler RepHtml
sshConfigurator a = bootstrap (Just Config) $ do
@ -96,8 +96,7 @@ usable UsableSshInput = True
getAddSshR :: Handler RepHtml
getAddSshR = sshConfigurator $ do
u <- liftIO $ T.pack . userName
<$> (getUserEntryForID =<< getEffectiveUserID)
u <- liftIO $ T.pack <$> myUserName
((result, form), enctype) <- lift $
runFormGet $ renderBootstrap $ sshInputAForm $
SshInput Nothing (Just u) Nothing