@@ -6,7 +6,6 @@ import Html exposing (..)
6import Html.Attributes as Attr
6import Html.Attributes as Attr
7import Html.Events as Ev
7import Html.Events as Ev
8import Page exposing (..)
8import Page exposing (..)
9−import Types exposing (CipherId)
10import Utils exposing (..)
9import Utils exposing (..)
@@ -85,275 +84,287 @@ row { name, nameIcon, attrs } =
86view : Model -> List (Html Msg)
85view : Model -> List (Html Msg)
87view { fullCipher } =
86view { fullCipher } =
88− case fullCipher.cipher of
87+ [ row
89− Bridge.LoginCipher cipher ->
88+ { name = "Entry name"
90− let
89+ , nameIcon = ""
91− { username, password, uris } =
90+ , attrs =
92− cipher
91+ [ Attr.type_ "text"
93−
92+ , Attr.value fullCipher.name
95− { fullCipher | cipher = Bridge.LoginCipher c } |> EditCipher
93+ , Ev.onInput (\x -> { fullCipher | name = x } |> EditCipher)
102− , Attr.value (Maybe.withDefault "" username)
103− , Ev.onInput (\x -> edit { cipher | username = Just x })
104− , Attr.attribute "autocomplete" "username"
109− , nameIcon = "security"
112− , Attr.value (Maybe.withDefault "" password)
113− , Ev.onInput (\x -> edit { cipher | password = Just x })
114− , Attr.attribute "autocomplete" "new-password"
94+ , Attr.attribute "autocomplete" "off"
119− |> List.indexedMap
97+ ]
120− (\i uri ->
98+ ++ (case fullCipher.cipher of
121− row
99+ Bridge.LoginCipher cipher ->
122− { name = "URL"
100+ let
123− , nameIcon = "get-link"
101+ { username, password, uris } =
124− , attrs =
102+ cipher
125− [ Attr.type_ "url"
103+
126− , Attr.value uri
104+ edit c =
127− , Ev.onInput (\x -> edit { cipher | uris = replace i x uris })
105+ { fullCipher | cipher = Bridge.LoginCipher c } |> EditCipher
133− { name = "URL"
108+ { name = "Username"
134− , nameIcon = "get-link"
109+ , nameIcon = "user"
135 , attrs =
110 , attrs =
136− [ Attr.type_ "url"
111+ [ Attr.type_ "text"
112+ , Attr.value (Maybe.withDefault "" username)
137− , Ev.onInput (\x -> edit { cipher | uris = uris ++ [ x ] })
113+ , Ev.onInput (\x -> edit { cipher | username = Just x })
114+ , Attr.attribute "autocomplete" "username"
119+ , nameIcon = "security"
122+ , Attr.value (Maybe.withDefault "" password)
123+ , Ev.onInput (\x -> edit { cipher | password = Just x })
124+ , Attr.attribute "autocomplete" "new-password"
142− Bridge.NoteCipher contents ->
144− [ heading "switcher-environments" "Note"
147− [ Attr.spellcheck True
148− , Attr.style "height" "70vh"
149− , Attr.value contents
150− , Ev.onInput (\x -> EditCipher { fullCipher | cipher = Bridge.NoteCipher x })
156− Bridge.CardCipher cipher ->
158− { number, code, cardholderName, expMonth, expYear } =
162− { fullCipher | cipher = Bridge.CardCipher c } |> EditCipher
165− { name = "Card number"
166− , nameIcon = "containers"
168− [ Attr.attribute "autocomplete" "cc-number"
170− , Attr.value (Maybe.withDefault "" number)
171− , Ev.onInput (\x -> edit { cipher | number = Just x })
175− [ heading "timed-out" "Expiration date"
178− [ Attr.attribute "autocomplete" "cc-exp-month"
180− , Attr.value (Maybe.withDefault "" expMonth)
181− , Ev.onInput (\x -> edit { cipher | expMonth = Just x })
182− , Attr.style "width" "20%"
183− , Attr.class "u-align--right"
188− [ Attr.attribute "autocomplete" "cc-exp-year"
190− , Attr.value (Maybe.withDefault "" expYear)
191− , Ev.onInput (\x -> edit { cipher | expYear = Just x })
192− , Attr.style "width" "20%"
198− , nameIcon = "security"
200− [ Attr.attribute "autocomplete" "cc-csc"
202− , Attr.value (Maybe.withDefault "" code)
203− , Ev.onInput (\x -> edit { cipher | code = Just x })
207− { name = "Cardholder name"
132+ { name = "URL"
208− , nameIcon = "user"
133+ , nameIcon = "get-link"
209− , attrs =
134+ , attrs =
210− [ Attr.attribute "autocomplete" "cc-name"
135+ [ Attr.type_ "url"
137+ , Ev.onInput (\x -> edit { cipher | uris = replace i x uris })
144+ , nameIcon = "get-link"
211− , Attr.type_ "text"
146+ [ Attr.type_ "url"
212− , Attr.value (Maybe.withDefault "" cardholderName)
147+ , Ev.onInput (\x -> edit { cipher | uris = uris ++ [ x ] })
213− , Ev.onInput (\x -> edit { cipher | cardholderName = Just x })
148+ ]
152+ Bridge.NoteCipher contents ->
154+ [ heading "switcher-environments" "Note"
157+ [ Attr.spellcheck True
158+ , Attr.style "height" "70vh"
159+ , Attr.value contents
160+ , Ev.onInput (\x -> EditCipher { fullCipher | cipher = Bridge.NoteCipher x })
218− Bridge.IdentityCipher cipher ->
166+ Bridge.CardCipher cipher ->
220− { address1, address2, address3, company, email, firstName, lastName, licenseNumber, middleName, passportNumber, phone, ssn, username } =
168+ { number, code, cardholderName, expMonth, expYear } =
223− edit c =
171+ edit c =
224− { fullCipher | cipher = Bridge.IdentityCipher c } |> EditCipher
172+ { fullCipher | cipher = Bridge.CardCipher c } |> EditCipher
227− { name = "First name"
175+ { name = "Card number"
228− , nameIcon = ""
176+ , nameIcon = "containers"
229− , attrs =
177+ , attrs =
230− [ Attr.attribute "autocomplete" "given-name"
178+ [ Attr.attribute "autocomplete" "cc-number"
231− , Attr.type_ "text"
179+ , Attr.type_ "text"
232− , Attr.value (Maybe.withDefault "" firstName)
180+ , Attr.value (Maybe.withDefault "" number)
233− , Ev.onInput (\x -> edit { cipher | firstName = Just x })
181+ , Ev.onInput (\x -> edit { cipher | number = Just x })
237− { name = "Middle name"
185+ [ heading "timed-out" "Expiration date"
238− , nameIcon = ""
186+ , br [] []
239− , attrs =
187+ , input
240− [ Attr.attribute "autocomplete" "additional-name"
188+ [ Attr.attribute "autocomplete" "cc-exp-month"
241− , Attr.type_ "text"
189+ , Attr.type_ "text"
242− , Attr.value (Maybe.withDefault "" middleName)
190+ , Attr.value (Maybe.withDefault "" expMonth)
243− , Ev.onInput (\x -> edit { cipher | middleName = Just x })
191+ , Ev.onInput (\x -> edit { cipher | expMonth = Just x })
244− ]
192+ , Attr.style "width" "20%"
245− }
193+ , Attr.class "u-align--right"
247− { name = "Last name"
250− [ Attr.attribute "autocomplete" "family-name"
252− , Attr.value (Maybe.withDefault "" lastName)
253− , Ev.onInput (\x -> edit { cipher | lastName = Just x })
260− [ Attr.attribute "autocomplete" "username"
198+ [ Attr.attribute "autocomplete" "cc-exp-year"
261− , Attr.type_ "text"
199+ , Attr.type_ "text"
262− , Attr.value (Maybe.withDefault "" username)
200+ , Attr.value (Maybe.withDefault "" expYear)
263− , Ev.onInput (\x -> edit { cipher | username = Just x })
201+ , Ev.onInput (\x -> edit { cipher | expYear = Just x })
264− ]
202+ , Attr.style "width" "20%"
267− { name = "Company"
205+ ]
268− , nameIcon = ""
206+ , row
269− , attrs =
207+ { name = "CVV"
270− [ Attr.attribute "autocomplete" "organization"
272− , Attr.value (Maybe.withDefault "" company)
273− , Ev.onInput (\x -> edit { cipher | company = Just x })
277− { name = "Social security number"
208+ , nameIcon = "security"
280− [ Attr.attribute "autocomplete" "off"
281− , Attr.type_ "number"
282− , Attr.value (Maybe.withDefault "" ssn)
283− , Ev.onInput (\x -> edit { cipher | ssn = Just x })
287− { name = "Passport number"
290− [ Attr.attribute "autocomplete" "off"
291− , Attr.type_ "number"
292− , Attr.value (Maybe.withDefault "" passportNumber)
293− , Ev.onInput (\x -> edit { cipher | passportNumber = Just x })
297− { name = "License Number"
300− [ Attr.attribute "autocomplete" "off"
301− , Attr.type_ "number"
302− , Attr.value (Maybe.withDefault "" licenseNumber)
303− , Ev.onInput (\x -> edit { cipher | licenseNumber = Just x })
310− [ Attr.attribute "autocomplete" "email"
311− , Attr.type_ "email"
312− , Attr.value (Maybe.withDefault "" email)
313− , Ev.onInput (\x -> edit { cipher | email = Just x })
317− { name = "Phone number"
319− , attrs =
209+ , attrs =
320− [ Attr.attribute "autocomplete" "tel"
210+ [ Attr.attribute "autocomplete" "cc-csc"
321− , Attr.type_ "tel"
211+ , Attr.type_ "text"
322− , Attr.value (Maybe.withDefault "" phone)
212+ , Attr.value (Maybe.withDefault "" code)
323− , Ev.onInput (\x -> edit { cipher | phone = Just x })
213+ , Ev.onInput (\x -> edit { cipher | code = Just x })
327− { name = "Address line 1"
217+ { name = "Cardholder name"
328− , nameIcon = ""
218+ , nameIcon = "user"
329− , attrs =
219+ , attrs =
330− [ Attr.attribute "autocomplete" "address-line1"
220+ [ Attr.attribute "autocomplete" "cc-name"
331− , Attr.type_ "text"
221+ , Attr.type_ "text"
332− , Attr.value (Maybe.withDefault "" address1)
222+ , Attr.value (Maybe.withDefault "" cardholderName)
333− , Ev.onInput (\x -> edit { cipher | address1 = Just x })
223+ , Ev.onInput (\x -> edit { cipher | cardholderName = Just x })
337− { name = "Address line 2"
340− [ Attr.attribute "autocomplete" "address-line2"
342− , Attr.value (Maybe.withDefault "" address2)
343− , Ev.onInput (\x -> edit { cipher | address2 = Just x })
228+ Bridge.IdentityCipher cipher ->
230+ { address1, address2, address3, company, email, firstName, lastName, licenseNumber, middleName, passportNumber, phone, ssn, username } =
234+ { fullCipher | cipher = Bridge.IdentityCipher c } |> EditCipher
237+ { name = "First name"
240+ [ Attr.attribute "autocomplete" "given-name"
242+ , Attr.value (Maybe.withDefault "" firstName)
243+ , Ev.onInput (\x -> edit { cipher | firstName = Just x })
247+ { name = "Middle name"
250+ [ Attr.attribute "autocomplete" "additional-name"
252+ , Attr.value (Maybe.withDefault "" middleName)
253+ , Ev.onInput (\x -> edit { cipher | middleName = Just x })
257+ { name = "Last name"
260+ [ Attr.attribute "autocomplete" "family-name"
262+ , Attr.value (Maybe.withDefault "" lastName)
263+ , Ev.onInput (\x -> edit { cipher | lastName = Just x })
270+ [ Attr.attribute "autocomplete" "username"
272+ , Attr.value (Maybe.withDefault "" username)
273+ , Ev.onInput (\x -> edit { cipher | username = Just x })
280+ [ Attr.attribute "autocomplete" "organization"
282+ , Attr.value (Maybe.withDefault "" company)
283+ , Ev.onInput (\x -> edit { cipher | company = Just x })
287+ { name = "Social security number"
290+ [ Attr.attribute "autocomplete" "off"
291+ , Attr.type_ "number"
292+ , Attr.value (Maybe.withDefault "" ssn)
293+ , Ev.onInput (\x -> edit { cipher | ssn = Just x })
297+ { name = "Passport number"
300+ [ Attr.attribute "autocomplete" "off"
301+ , Attr.type_ "number"
302+ , Attr.value (Maybe.withDefault "" passportNumber)
303+ , Ev.onInput (\x -> edit { cipher | passportNumber = Just x })
307+ { name = "License Number"
310+ [ Attr.attribute "autocomplete" "off"
311+ , Attr.type_ "number"
312+ , Attr.value (Maybe.withDefault "" licenseNumber)
313+ , Ev.onInput (\x -> edit { cipher | licenseNumber = Just x })
320+ [ Attr.attribute "autocomplete" "email"
321+ , Attr.type_ "email"
322+ , Attr.value (Maybe.withDefault "" email)
323+ , Ev.onInput (\x -> edit { cipher | email = Just x })
327+ { name = "Phone number"
330+ [ Attr.attribute "autocomplete" "tel"
332+ , Attr.value (Maybe.withDefault "" phone)
333+ , Ev.onInput (\x -> edit { cipher | phone = Just x })
337+ { name = "Address line 1"
340+ [ Attr.attribute "autocomplete" "address-line1"
342+ , Attr.value (Maybe.withDefault "" address1)
343+ , Ev.onInput (\x -> edit { cipher | address1 = Just x })
347+ { name = "Address line 2"
350+ [ Attr.attribute "autocomplete" "address-line2"
352+ , Attr.value (Maybe.withDefault "" address2)
353+ , Ev.onInput (\x -> edit { cipher | address2 = Just x })
347− { name = "Address line 3"
357+ { name = "Address line 3"
348− , nameIcon = ""
358+ , nameIcon = ""
349− , attrs =
359+ , attrs =
350− [ Attr.attribute "autocomplete" "address-line3"
360+ [ Attr.attribute "autocomplete" "address-line3"
351− , Attr.type_ "text"
361+ , Attr.type_ "text"
352− , Attr.value (Maybe.withDefault "" address3)
362+ , Attr.value (Maybe.withDefault "" address3)
353− , Ev.onInput (\x -> edit { cipher | address3 = Just x })
363+ , Ev.onInput (\x -> edit { cipher | address3 = Just x })
359hiddenPassword : String
370hiddenPassword : String