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:
@@ -5,7 +5,6 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@polkadot/extension-inject": "^0.1.0",
|
||||
"@polkadot/ui-identicon": "^0.39.0-beta.5",
|
||||
"@types/react-router-dom": "^4.3.2",
|
||||
"react-router": "^5.0.0",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// 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 { approveRequest } from '../../messaging';
|
||||
@@ -14,22 +14,32 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function Unlock ({ isVisible, onAction, signId }: Props) {
|
||||
const [error, setError] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
|
||||
if (!isVisible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (error) {
|
||||
setError('');
|
||||
}
|
||||
}, [password]);
|
||||
|
||||
const _onSign = (): void => {
|
||||
approveRequest(signId, password)
|
||||
.then(onAction)
|
||||
.catch(console.error);
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
setError(error.message);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Input
|
||||
isError={!password}
|
||||
isError={!password || !!error}
|
||||
isFocussed
|
||||
label='password for this account'
|
||||
onChange={setPassword}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^0.79.0-beta.31",
|
||||
"@polkadot/extension-inject": "^0.1.0",
|
||||
"@polkadot/extension-ui": "^0.1.0",
|
||||
"@polkadot/ui-keyring": "^0.39.0-beta.5"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "polkadot{.js} extension",
|
||||
"version": "0.0.1",
|
||||
"version": "0.1.0",
|
||||
"manifest_version": 2,
|
||||
"permissions": ["activeTab", "storage"],
|
||||
"background": {
|
||||
|
||||
Reference in New Issue
Block a user