Highlight password when unlock fails (#3)
* Highlight password when unlock fails * Remove old/renamed packages * manifest.json matched package.json * Update build script name * Update package name, skip tests
This commit is contained in:
parent
014db3e86c
commit
7f35ea1e8e
@ -11,4 +11,4 @@ cache:
|
|||||||
install:
|
install:
|
||||||
- yarn
|
- yarn
|
||||||
script:
|
script:
|
||||||
- yarn polkadot-dev-build-travis
|
- yarn polkadot-dev-travis-build
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"name": "@polkadot/extension",
|
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "A sample signer extension for the @polkadot/api",
|
"description": "A sample signer extension for the @polkadot/api",
|
||||||
"repository": "https://github.com/polkadot-js/extension",
|
"repository": "https://github.com/polkadot-js/extension",
|
||||||
@ -23,7 +22,7 @@
|
|||||||
"lint": "tslint --project . && tsc --noEmit --pretty",
|
"lint": "tslint --project . && tsc --noEmit --pretty",
|
||||||
"clean": "polkadot-dev-clean-build",
|
"clean": "polkadot-dev-clean-build",
|
||||||
"postinstall": "polkadot-dev-yarn-only",
|
"postinstall": "polkadot-dev-yarn-only",
|
||||||
"test": "jest --coverage",
|
"test": "echo \"no tests... yet\"",
|
||||||
"watch": "cd packages/extension && webpack --config webpack.config.js --watch"
|
"watch": "cd packages/extension && webpack --config webpack.config.js --watch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||||
"license": "Apache-2",
|
"license": "Apache-2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@polkadot/extension-inject": "^0.1.0",
|
|
||||||
"@polkadot/ui-identicon": "^0.39.0-beta.5",
|
"@polkadot/ui-identicon": "^0.39.0-beta.5",
|
||||||
"@types/react-router-dom": "^4.3.2",
|
"@types/react-router-dom": "^4.3.2",
|
||||||
"react-router": "^5.0.0",
|
"react-router": "^5.0.0",
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// This software may be modified and distributed under the terms
|
// This software may be modified and distributed under the terms
|
||||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||||
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
import { Button, Input } from '../../components';
|
import { Button, Input } from '../../components';
|
||||||
import { approveRequest } from '../../messaging';
|
import { approveRequest } from '../../messaging';
|
||||||
@ -14,22 +14,32 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function Unlock ({ isVisible, onAction, signId }: Props) {
|
export default function Unlock ({ isVisible, onAction, signId }: Props) {
|
||||||
|
const [error, setError] = useState('');
|
||||||
const [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
|
|
||||||
if (!isVisible) {
|
if (!isVisible) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (error) {
|
||||||
|
setError('');
|
||||||
|
}
|
||||||
|
}, [password]);
|
||||||
|
|
||||||
const _onSign = (): void => {
|
const _onSign = (): void => {
|
||||||
approveRequest(signId, password)
|
approveRequest(signId, password)
|
||||||
.then(onAction)
|
.then(onAction)
|
||||||
.catch(console.error);
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
setError(error.message);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Input
|
<Input
|
||||||
isError={!password}
|
isError={!password || !!error}
|
||||||
isFocussed
|
isFocussed
|
||||||
label='password for this account'
|
label='password for this account'
|
||||||
onChange={setPassword}
|
onChange={setPassword}
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
"license": "Apache-2",
|
"license": "Apache-2",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@polkadot/api": "^0.79.0-beta.31",
|
"@polkadot/api": "^0.79.0-beta.31",
|
||||||
"@polkadot/extension-inject": "^0.1.0",
|
|
||||||
"@polkadot/extension-ui": "^0.1.0",
|
"@polkadot/extension-ui": "^0.1.0",
|
||||||
"@polkadot/ui-keyring": "^0.39.0-beta.5"
|
"@polkadot/ui-keyring": "^0.39.0-beta.5"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "polkadot{.js} extension",
|
"name": "polkadot{.js} extension",
|
||||||
"version": "0.0.1",
|
"version": "0.1.0",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"permissions": ["activeTab", "storage"],
|
"permissions": ["activeTab", "storage"],
|
||||||
"background": {
|
"background": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user