summaryrefslogtreecommitdiff
path: root/ui/app/components/password_field.js
diff options
context:
space:
mode:
authorSimon Fondrie-Teitler <simonft@riseup.net>2017-04-26 20:28:27 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2017-05-04 16:27:23 +0200
commitaa8cf504f876182048e1f0e5b72b234b10a7f472 (patch)
tree2fc444b7b3c622621bb9f594e7b664eb5293d136 /ui/app/components/password_field.js
parenta6437a3f30a8690b5cb0cf9bad2d0e5253743039 (diff)
[feat] Go to first open line when enter is pressed
When filling out the signup or login pages, and when adding an additional service provider, the enter key will trigger the submit action. When on the choose provider page, enter will take you to the next page. - Resolves: #8841
Diffstat (limited to 'ui/app/components/password_field.js')
-rw-r--r--ui/app/components/password_field.js28
1 files changed, 16 insertions, 12 deletions
diff --git a/ui/app/components/password_field.js b/ui/app/components/password_field.js
index 8397967f..654b8a57 100644
--- a/ui/app/components/password_field.js
+++ b/ui/app/components/password_field.js
@@ -8,13 +8,16 @@ import Validate from 'lib/validate'
export default class PasswordField extends React.Component {
- static get defaultProps() {return{
- id: null, // required. controlId of the element
- label: "Password",
- onChange: null, // callback passed current password
- validationMode: "crack", // one of 'none', 'match', 'crack'
- matchText: null, // used if validationMode == 'match'
- }}
+ static get defaultProps() {
+ return {
+ id: null, // required. controlId of the element
+ label: "Password",
+ onChange: null, // callback passed current password
+ validationMode: "crack", // one of 'none', 'match', 'crack'
+ matchText: null, // used if validationMode == 'match'
+ inputRef: null, // a ref to the input. Used to set focus
+ }
+ }
constructor(props) {
super(props)
@@ -43,14 +46,15 @@ export default class PasswordField extends React.Component {
<FormGroup controlId={this.props.id} validationState={this.state.passwordState}>
<ControlLabel>{this.props.label}</ControlLabel>
<FormControl
- type="password"
- ref="password"
- value={this.state.password || ""}
- onChange={this.keypress} />
+ type="password"
+ inputRef={this.props.inputRef}
+ value={this.state.password || ""}
+ onChange={this.keypress}
+ />
{this.state.passwordState == 'success' ? null : <FormControl.Feedback/>}
{passwordHelp}
</FormGroup>
- )
+ )
}
keypress(e) {