on master help sign in
feat: implement conditional ticket masking following passwordmasking.com recs
571ddd2Matt Condon (shrugs)
src/views/Login/Ticket.js+51−18
@@ -3,7 +3,7 @@ import { Just } from 'folktale/maybe';
3import cn from 'classnames';
3import cn from 'classnames';
4import * as azimuth from 'azimuth-js';
4import * as azimuth from 'azimuth-js';
5import * as kg from 'urbit-key-generation/dist/index';
5import * as kg from 'urbit-key-generation/dist/index';
6−import { Grid, CheckboxInput } from 'indigo-react';
6+import { Grid, CheckboxInput, Flex, ToggleInput } from 'indigo-react';
7import { FORM_ERROR } from 'final-form';
7import { FORM_ERROR } from 'final-form';
8
8
9import { useNetwork } from 'store/network';
9import { useNetwork } from 'store/network';
@@ -135,6 +135,8 @@ export default function Ticket({ className, goHome }) {
135 point: impliedPoint || '',
135 point: impliedPoint || '',
136 usePasshrase: false,
136 usePasshrase: false,
137 useShards: false,
137 useShards: false,
138+ showTicket: true,
139+ useAdvanced: false,
138 }),
140 }),
139 [impliedPoint]
141 [impliedPoint]
140 );
142 );
@@ -146,7 +148,7 @@ export default function Ticket({ className, goHome }) {
146 onSubmit={onSubmit}
148 onSubmit={onSubmit}
147 afterSubmit={goHome}
149 afterSubmit={goHome}
148 initialValues={initialValues}>
150 initialValues={initialValues}>
149− {({ handleSubmit, submitting }) => (
151+ {({ handleSubmit, values, submitting }) => (
150 <>
152 <>
151 <Grid.Item full as={PointInput} name="point" />
153 <Grid.Item full as={PointInput} name="point" />
152
154
@@ -156,15 +158,36 @@ export default function Ticket({ className, goHome }) {
156 as={TicketInput}
158 as={TicketInput}
157 name="ticket"
159 name="ticket"
158 label="Master Ticket"
160 label="Master Ticket"
161+ type={values.showTicket ? 'text' : 'password'}
159 />
162 />
160 </Condition>
163 </Condition>
161
164
162 <Condition when="useShards" is={true}>
165 <Condition when="useShards" is={true}>
166+ <Grid.Item
167+ full
163− <Grid.Item full as={TicketInput} name="shard1" label="Shard 1" />
168+ as={TicketInput}
169+ name="shard1"
170+ label="Shard 1"
171+ type={values.showTicket ? 'text' : 'password'}
172+ />
173+ <Grid.Item
174+ full
164− <Grid.Item full as={TicketInput} name="shard2" label="Shard 2" />
175+ as={TicketInput}
176+ name="shard2"
177+ label="Shard 2"
178+ type={values.showTicket ? 'text' : 'password'}
179+ />
180+ <Grid.Item
181+ full
165− <Grid.Item full as={TicketInput} name="shard3" label="Shard 3" />
182+ as={TicketInput}
183+ name="shard3"
184+ label="Shard 3"
185+ type={values.showTicket ? 'text' : 'password'}
186+ />
166 </Condition>
187 </Condition>
167
188
189+ <Grid.Item full as={CheckboxInput} name="showTicket" label="Show" />
190+
168 <Condition when="usePassphrase" is={true}>
191 <Condition when="usePassphrase" is={true}>
169 <Grid.Item
192 <Grid.Item
170 full
193 full
@@ -174,19 +197,6 @@ export default function Ticket({ className, goHome }) {
174 />
197 />
175 </Condition>
198 </Condition>
176
199
177− <Grid.Item
178− full
179− as={CheckboxInput}
180− name="usePassphrase"
181− label="Passphrase"
182− />
183− <Grid.Item
184− full
185− as={CheckboxInput}
186− name="useShards"
187− label="Shards"
188− />
189−
190 <Grid.Item full as={FormError} />
200 <Grid.Item full as={FormError} />
191
201
192 <Grid.Item full as={SubmitButton} handleSubmit={handleSubmit}>
202 <Grid.Item full as={SubmitButton} handleSubmit={handleSubmit}>
@@ -198,6 +208,29 @@ export default function Ticket({ className, goHome }) {
198 : 'Continue'
208 : 'Continue'
199 }
209 }
200 </Grid.Item>
210 </Grid.Item>
211+
212+ <Grid.Item full as={Flex} justify="between">
213+ <Flex.Item
214+ as={ToggleInput}
215+ name="useAdvanced"
216+ label="Advanced"
217+ inverseLabel="Hide"
218+ />
219+ <Condition when="useAdvanced" is={true}>
220+ <Flex.Item as={Flex}>
221+ <Flex.Item
222+ as={CheckboxInput}
223+ name="usePassphrase"
224+ label="Passphrase"
225+ />
226+ <Flex.Item
227+ as={CheckboxInput}
228+ name="useShards"
229+ label="Shards"
230+ />
231+ </Flex.Item>
232+ </Condition>
233+ </Grid.Item>
201 </>
234 </>
202 )}
235 )}
203 </BridgeForm>
236 </BridgeForm>