Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gui: support user/password for RPC authentication #898

Merged
merged 3 commits into from
Jan 3, 2024

Conversation

jp1ac4
Copy link
Collaborator

@jp1ac4 jp1ac4 commented Dec 28, 2023

This adds support to the GUI for user and password RPC authentication as part of #356.

The first commit adds the user/password option to the settings page, and only updates the installer as required for it to compile. It also changes how the managed bitcoind gets the cookie location when starting so that it doesn't rely on the config file.

The second commit adds the user/password option to the installer when using a self-managed node.

Updating the managed node to use user/password can be done in a follow-up PR.

Copy link
Member

@darosior darosior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from some quick testing!

Comment on lines +259 to +266
row.push(radio(
format!("{}", auth_type),
*auth_type,
Some(*selected_auth_type),
SettingsEditMessage::BitcoindRpcAuthTypeSelected,
))
.spacing(30)
.align_items(Alignment::Center)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, i like the radio button. Just let's not make them green?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking through the rest of the interface most buttons do get green when hovered though.

Comment on lines 286 to 301
.push(
form::Form::new_trimmed("User", &rpc_auth_vals.user, |value| {
SettingsEditMessage::FieldEdited("user", value)
})
.warning("Please enter a valid user")
.size(20)
.padding(5),
)
.push(
form::Form::new_trimmed("Password", &rpc_auth_vals.password, |value| {
SettingsEditMessage::FieldEdited("password", value)
})
.warning("Please enter a valid password")
.size(20)
.padding(5),
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we add a small marging in-between the two text inputs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now added spacing(10) between them in both settings and installer.

Comment on lines +812 to +832
[RpcAuthType::CookieFile, RpcAuthType::UserPass]
.iter()
.fold(
Row::new()
.push(text("RPC authentication:").small().bold())
.spacing(10),
|row, auth_type| {
row.push(radio(
format!("{}", auth_type),
*auth_type,
Some(*selected_auth_type),
|new_selection| {
Message::DefineBitcoind(
message::DefineBitcoind::RpcAuthTypeSelected(new_selection),
)
},
))
.spacing(30)
.align_items(Alignment::Center)
},
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment regarding the radio buttons here:
image

They should have the same style as the other buttons around, i think.

This change updates the GUI to support the latest lianad config
file with the user/password option for bitcoind RPC authentication.

The settings have been updated to set either cookie file path
or user and password.

The installer still only supports the cookie file and has only
been updated with the changes required to compile.

When starting, the internal bitcoind now looks for the cookie file
in the usual location rather than relying on the config file.
If using a self-managed node, this adds the option to authenticate
with the RPC server using user and password.
@jp1ac4
Copy link
Collaborator Author

jp1ac4 commented Dec 28, 2023

In a separate commit, I've modified the radio button theme to only have the green border when hovering over it. The selected button still uses a green dot, which is similar to a checkbox that has been ticked.

image

I'm happy to make further changes to the radio button theme as part of this PR.

@darosior
Copy link
Member

darosior commented Jan 3, 2024

ACK 838550b

@darosior darosior merged commit 051957e into wizardsardine:master Jan 3, 2024
18 checks passed
@jp1ac4 jp1ac4 deleted the gui-rpc-userpass branch January 3, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants