@@ -24,10 +24,17 @@ import { FormButton } from 'browser-components/buttons'
2424import {
2525 StyledConnectionForm ,
2626 StyledConnectionTextInput ,
27+ StyledConnectionSelect ,
2728 StyledConnectionLabel ,
2829 StyledConnectionFormEntry
2930} from './styled'
3031import InputEnterStepping from 'browser-components/InputEnterStepping/InputEnterStepping'
32+ import { NATIVE , NO_AUTH } from 'services/bolt/boltHelpers'
33+
34+ const readableauthenticationMethods = {
35+ [ NATIVE ] : 'Username / Password' ,
36+ [ NO_AUTH ] : 'No authentication'
37+ }
3138
3239export default class ConnectForm extends Component {
3340 state = {
@@ -63,31 +70,54 @@ export default class ConnectForm extends Component {
6370 } ) }
6471 />
6572 </ StyledConnectionFormEntry >
66-
6773 < StyledConnectionFormEntry >
68- < StyledConnectionLabel > Username</ StyledConnectionLabel >
69- < StyledConnectionTextInput
74+ < StyledConnectionLabel >
75+ Authentication type
76+ </ StyledConnectionLabel >
77+ < StyledConnectionSelect
7078 { ...getInputPropsForIndex ( 1 , {
71- 'data-testid' : 'username ' ,
72- onChange : this . props . onUsernameChange ,
73- defaultValue : this . props . username ,
79+ 'data-testid' : 'authenticationMethod ' ,
80+ onChange : this . props . onAuthenticationMethodChange ,
81+ value : this . props . authenticationMethod ,
7482 ref : ref => setRefForIndex ( 1 , ref )
7583 } ) }
76- />
84+ >
85+ { [ NATIVE , NO_AUTH ] . map ( ( auth , i ) => (
86+ < option value = { auth } key = { i } >
87+ { readableauthenticationMethods [ auth ] }
88+ </ option >
89+ ) ) }
90+ </ StyledConnectionSelect >
7791 </ StyledConnectionFormEntry >
7892
79- < StyledConnectionFormEntry >
80- < StyledConnectionLabel > Password</ StyledConnectionLabel >
81- < StyledConnectionTextInput
82- { ...getInputPropsForIndex ( 2 , {
83- 'data-testid' : 'password' ,
84- onChange : this . props . onPasswordChange ,
85- defaultValue : this . props . password ,
86- type : 'password' ,
87- ref : ref => setRefForIndex ( 2 , ref )
88- } ) }
89- />
90- </ StyledConnectionFormEntry >
93+ { this . props . authenticationMethod === NATIVE && (
94+ < StyledConnectionFormEntry >
95+ < StyledConnectionLabel > Username</ StyledConnectionLabel >
96+ < StyledConnectionTextInput
97+ { ...getInputPropsForIndex ( 2 , {
98+ 'data-testid' : 'username' ,
99+ onChange : this . props . onUsernameChange ,
100+ defaultValue : this . props . username ,
101+ ref : ref => setRefForIndex ( 2 , ref )
102+ } ) }
103+ />
104+ </ StyledConnectionFormEntry >
105+ ) }
106+
107+ { this . props . authenticationMethod === NATIVE && (
108+ < StyledConnectionFormEntry >
109+ < StyledConnectionLabel > Password</ StyledConnectionLabel >
110+ < StyledConnectionTextInput
111+ { ...getInputPropsForIndex ( 3 , {
112+ 'data-testid' : 'password' ,
113+ onChange : this . props . onPasswordChange ,
114+ defaultValue : this . props . password ,
115+ type : 'password' ,
116+ ref : ref => setRefForIndex ( 3 , ref )
117+ } ) }
118+ />
119+ </ StyledConnectionFormEntry >
120+ ) }
91121
92122 < Render if = { ! this . state . connecting } >
93123 < FormButton data-testid = 'connect' { ...getSubmitProps ( ) } >
0 commit comments