Add wrong password indication (#1364)

* add wronf password indication

* white space

* with className

* alphabetical order
This commit is contained in:
Thibaut Sardan 2019-07-08 12:01:03 +02:00 committed by GitHub
parent 5d163145bc
commit 5528247e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 9 deletions

View File

@ -19,9 +19,10 @@ import keyring from '@polkadot/ui-keyring';
import { assert, isFunction } from '@polkadot/util';
import { format } from '@polkadot/util/logger';
import PasswordCheck from './PasswordCheck';
import Transaction from './Transaction';
import Unlock from './Unlock';
import translate from './translate';
import Unlock from './Unlock';
type BaseProps = BareProps & {
queue: Array<QueueTx>,
@ -167,14 +168,19 @@ class Signer extends React.PureComponent<Props, State> {
}
return (
<Unlock
autoFocus
error={unlockError || undefined}
onChange={this.onChangePassword}
password={password}
value={currentItem.accountId}
tabIndex={1}
/>
<>
<Unlock
autoFocus
error={unlockError || undefined}
onChange={this.onChangePassword}
password={password}
value={currentItem.accountId}
tabIndex={1}
/>
<PasswordCheck
unlockError={unlockError}
/>
</>
);
}

View File

@ -0,0 +1,32 @@
// Copyright 2017-2019 @polkadot/ui-signer authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { I18nProps } from '@polkadot/ui-app/types';
import React from 'react';
import styled from 'styled-components';
import { withMulti } from '@polkadot/ui-api';
import translate from './translate';
type Props = I18nProps & {
className?: string,
unlockError?: string | null
};
function PasswordCheck (props: Props) {
const { className, unlockError, t } = props;
return unlockError
? <div className={className}>{t('wrong password')}</div>
: null;
}
export default withMulti(
styled(PasswordCheck)`
margin-left: 15em;
color: #9f3a38;
`,
translate
);