-
Notifications
You must be signed in to change notification settings - Fork 295
/
PasswordInput.tsx
35 lines (33 loc) · 1.2 KB
/
PasswordInput.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// @flow
import classnames from 'classnames';
import React, { Component } from 'react';
import { intlShape } from 'react-intl';
import { PasswordInput as RPPasswordInput } from 'react-polymorph/lib/components/PasswordInput';
import type { PasswordInputProps } from 'react-polymorph/lib/components/PasswordInput';
import globalMessages from '../../../i18n/global-messages';
import styles from './PasswordInput.scss';
export type Props = PasswordInputProps;
export class PasswordInput extends Component<Props> {
static contextTypes = {
intl: intlShape.isRequired,
};
render() {
const { intl } = this.context;
const { className, ...pwInputProps } = this.props;
return (
<div className={classnames([styles.root, className])}>
<RPPasswordInput
{...pwInputProps}
passwordFeedbacks={{
insecure: intl.formatMessage(
globalMessages.invalidSpendingPassword
),
weak: intl.formatMessage(globalMessages.weakSpendingPassword),
strong: intl.formatMessage(globalMessages.strongSpendingPassword),
noMatch: intl.formatMessage(globalMessages.invalidRepeatPassword),
}}
/>
</div>
);
}
}