Display SSH key example as a placeholder, not a default value (thanks zPlus!)

This commit is contained in:
fr33domlover 2019-10-19 06:35:28 +00:00
parent 339c2253f9
commit e0d7612908

View file

@ -18,9 +18,7 @@ module Vervis.Form.Key
)
where
import Yesod.Form.Fields
import Yesod.Form.Functions
import Yesod.Form.Types
import Yesod.Form
import Vervis.Field.Key
import Vervis.Foundation
@ -30,13 +28,15 @@ import Vervis.Model.Ident
newKeyAForm :: PersonId -> AForm Handler SshKey
newKeyAForm pid = mk
<$> (text2ky <$> areq (nameField pid) "Name*" Nothing)
<*> areq sshKeyField "Content*" (Just defKey)
<*> areq sshKeyField keySettings Nothing
where
mk n (a, c) = SshKey n pid a c
keySettings =
FieldSettings
"Content*" Nothing Nothing Nothing [("placeholder", defKey)]
defKey =
( "ssh-rsa"
, "VGhpcyBpcyBub3QgYSBrZXksIHBsZWFzZSBwYXN0ZSBhIHJlYWwgb25lIDopCg=="
)
"ssh-rsa \
\AAAPcyBpcyubQgYBrZkWzZSBwY..."
newKeyForm :: PersonId -> Form SshKey
newKeyForm = renderDivs . newKeyAForm