fix: Update login page to verify password instead of opening as readonly
All checks were successful
Build Docker / Build Image (push) Successful in 49s
All checks were successful
Build Docker / Build Image (push) Successful in 49s
This commit is contained in:
parent
db5e672d7b
commit
9c32ec788e
Binary file not shown.
22
README.md
22
README.md
@ -1,6 +1,4 @@
|
||||
# FireWalletBrowser
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
@ -112,4 +110,22 @@ DNS Editor page
|
||||
![DNS Editor page](assets/dnseditor.png)
|
||||
|
||||
Auction page
|
||||
![Auction page](assets/auction.png)
|
||||
![Auction page](assets/auction.png)
|
||||
|
||||
## Environment variables
|
||||
|
||||
```yaml
|
||||
hsd_api: HSD API key
|
||||
hsd_ip: HSD IP address
|
||||
theme: Theme to use (dark-purple, black)
|
||||
show_expired: Show expired domains (true/false)
|
||||
exclude: Comma separated list of wallets to exclude from the wallet list
|
||||
```
|
||||
|
||||
|
||||
## Warnings
|
||||
|
||||
- This is a work in progress and is not guaranteed to work
|
||||
- This is not a wallet by itself but rather a frontend for HSD
|
||||
- I am not responsible for any loss of funds from using this wallet (including loss of funds from auctions)
|
||||
- I am not responsible if you expose this frontend to the internet (please don't do this unless you know what you are doing)
|
12
account.py
12
account.py
@ -26,7 +26,9 @@ hsw = api.hsw(APIKEY,ip)
|
||||
# Verify the connection
|
||||
response = hsd.getInfo()
|
||||
|
||||
|
||||
exclude = ["primary"]
|
||||
if os.getenv("exclude") is not None:
|
||||
exclude = os.getenv("exclude").split(",")
|
||||
|
||||
def check_account(cookie: str):
|
||||
if cookie is None:
|
||||
@ -52,9 +54,10 @@ def check_password(cookie: str, password: str):
|
||||
info = hsw.rpc_selectWallet(account)
|
||||
if info['error'] is not None:
|
||||
return False
|
||||
info = hsw.rpc_walletPassphrase(password,10)
|
||||
info = hsw.rpc_walletPassphrase(password,1)
|
||||
if info['error'] is not None:
|
||||
return False
|
||||
if info['error']['message'] != "Wallet is not encrypted.":
|
||||
return False
|
||||
return True
|
||||
|
||||
def createWallet(account: str, password: str):
|
||||
@ -118,6 +121,9 @@ def listWallets():
|
||||
|
||||
# Check if response is json or an array
|
||||
if isinstance(response, list):
|
||||
# Remove excluded wallets
|
||||
response = [wallet for wallet in response if wallet not in exclude]
|
||||
|
||||
return response
|
||||
return ['Wallet not connected']
|
||||
|
||||
|
10
main.py
10
main.py
@ -1154,16 +1154,20 @@ def login_post():
|
||||
|
||||
# Check if the account is valid
|
||||
if account.count(":") > 0:
|
||||
wallets = account_module.listWallets()
|
||||
wallets = render.wallets(wallets)
|
||||
return render_template("login.html", sync=account_module.getNodeSync(),
|
||||
wallet_status=account_module.getWalletStatus(),
|
||||
error="Invalid account")
|
||||
error="Invalid account",wallets=wallets)
|
||||
|
||||
account = account + ":" + password
|
||||
|
||||
# Check if the account is valid
|
||||
if not account_module.check_account(account):
|
||||
if not account_module.check_password(account,password):
|
||||
wallets = account_module.listWallets()
|
||||
wallets = render.wallets(wallets)
|
||||
return render_template("login.html", sync=account_module.getNodeSync(),
|
||||
error="Invalid account")
|
||||
error="Invalid account or password",wallets=wallets)
|
||||
|
||||
|
||||
# Set the cookie
|
||||
|
@ -126,7 +126,6 @@ def getPluginData(pluginStr: str):
|
||||
# Check if the plugin is in customPlugins
|
||||
if pluginStr.startswith("customPlugins"):
|
||||
# Get git url for dir
|
||||
print(f"cd customPlugins/{pluginStr.split('/')[-2]} && git remote get-url origin")
|
||||
url = subprocess.check_output(f"cd customPlugins/{pluginStr.split('/')[-2]} && git remote get-url origin", shell=True).decode("utf-8").strip()
|
||||
info["source"] = url
|
||||
|
||||
|
@ -42,7 +42,7 @@ functions = {
|
||||
}
|
||||
},
|
||||
"returns": {
|
||||
"status":
|
||||
"status":
|
||||
{
|
||||
"name": "Status of the function",
|
||||
"type": "text"
|
||||
|
@ -19,6 +19,7 @@
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-9 col-lg-12 col-xl-10">
|
||||
<h1 class="text-center" style="color: var(--bs-danger);background: var(--bs-primary);">{{error}}</h1>
|
||||
<div class="card shadow-lg o-hidden border-0 my-5">
|
||||
<div class="card-body p-0">
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user