diff options
Diffstat (limited to 'src/features/basicAuth')
-rw-r--r-- | src/features/basicAuth/Component.js | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/src/features/basicAuth/Component.js b/src/features/basicAuth/Component.js index a9601836b..3cf937f98 100644 --- a/src/features/basicAuth/Component.js +++ b/src/features/basicAuth/Component.js | |||
@@ -2,19 +2,14 @@ import React, { Component } from 'react'; | |||
2 | import PropTypes from 'prop-types'; | 2 | import PropTypes from 'prop-types'; |
3 | import injectSheet from 'react-jss'; | 3 | import injectSheet from 'react-jss'; |
4 | import { observer } from 'mobx-react'; | 4 | import { observer } from 'mobx-react'; |
5 | import { defineMessages, intlShape } from 'react-intl'; | 5 | import { defineMessages, injectIntl } from 'react-intl'; |
6 | import classnames from 'classnames'; | 6 | import classnames from 'classnames'; |
7 | 7 | ||
8 | import Modal from '../../components/ui/Modal'; | 8 | import Modal from '../../components/ui/Modal'; |
9 | import Input from '../../components/ui/Input'; | 9 | import Input from '../../components/ui/Input'; |
10 | import Button from '../../components/ui/Button'; | 10 | import Button from '../../components/ui/Button'; |
11 | 11 | ||
12 | import { | 12 | import { state, resetState, sendCredentials, cancelLogin } from './store'; |
13 | state, | ||
14 | resetState, | ||
15 | sendCredentials, | ||
16 | cancelLogin, | ||
17 | } from './store'; | ||
18 | import Form from './Form'; | 13 | import Form from './Form'; |
19 | 14 | ||
20 | import styles from './styles'; | 15 | import styles from './styles'; |
@@ -23,17 +18,15 @@ import globalMessages from '../../i18n/globalMessages'; | |||
23 | const messages = defineMessages({ | 18 | const messages = defineMessages({ |
24 | signIn: { | 19 | signIn: { |
25 | id: 'feature.basicAuth.signIn', | 20 | id: 'feature.basicAuth.signIn', |
26 | defaultMessage: '!!!Sign In', | 21 | defaultMessage: 'Sign In', |
27 | }, | 22 | }, |
28 | }); | 23 | }); |
29 | 24 | ||
30 | export default @injectSheet(styles) @observer class BasicAuthModal extends Component { | 25 | @injectSheet(styles) |
26 | @observer | ||
27 | class BasicAuthModal extends Component { | ||
31 | static propTypes = { | 28 | static propTypes = { |
32 | classes: PropTypes.object.isRequired, | 29 | classes: PropTypes.object.isRequired, |
33 | } | ||
34 | |||
35 | static contextTypes = { | ||
36 | intl: intlShape, | ||
37 | }; | 30 | }; |
38 | 31 | ||
39 | submit(e) { | 32 | submit(e) { |
@@ -56,20 +49,15 @@ export default @injectSheet(styles) @observer class BasicAuthModal extends Compo | |||
56 | } | 49 | } |
57 | 50 | ||
58 | render() { | 51 | render() { |
59 | const { | 52 | const { classes } = this.props; |
60 | classes, | ||
61 | } = this.props; | ||
62 | 53 | ||
63 | const { | 54 | const { isModalVisible, authInfo } = state; |
64 | isModalVisible, | ||
65 | authInfo, | ||
66 | } = state; | ||
67 | 55 | ||
68 | if (!authInfo) { | 56 | if (!authInfo) { |
69 | return null; | 57 | return null; |
70 | } | 58 | } |
71 | 59 | ||
72 | const { intl } = this.context; | 60 | const { intl } = this.props; |
73 | 61 | ||
74 | return ( | 62 | return ( |
75 | <Modal | 63 | <Modal |
@@ -89,10 +77,7 @@ export default @injectSheet(styles) @observer class BasicAuthModal extends Compo | |||
89 | onSubmit={this.submit.bind(this)} | 77 | onSubmit={this.submit.bind(this)} |
90 | className={classnames('franz-form', classes.form)} | 78 | className={classnames('franz-form', classes.form)} |
91 | > | 79 | > |
92 | <Input | 80 | <Input field={Form.$('user')} showLabel={false} /> |
93 | field={Form.$('user')} | ||
94 | showLabel={false} | ||
95 | /> | ||
96 | <Input | 81 | <Input |
97 | field={Form.$('password')} | 82 | field={Form.$('password')} |
98 | showLabel={false} | 83 | showLabel={false} |
@@ -105,13 +90,11 @@ export default @injectSheet(styles) @observer class BasicAuthModal extends Compo | |||
105 | buttonType="secondary" | 90 | buttonType="secondary" |
106 | onClick={this.cancel.bind(this)} | 91 | onClick={this.cancel.bind(this)} |
107 | /> | 92 | /> |
108 | <Button | 93 | <Button type="submit" label={intl.formatMessage(messages.signIn)} /> |
109 | type="submit" | ||
110 | label={intl.formatMessage(messages.signIn)} | ||
111 | /> | ||
112 | </div> | 94 | </div> |
113 | </form> | 95 | </form> |
114 | </Modal> | 96 | </Modal> |
115 | ); | 97 | ); |
116 | } | 98 | } |
117 | } | 99 | } |
100 | export default injectIntl(BasicAuthModal); | ||