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

Fix a pwdfield bug. #17

Merged
merged 1 commit into from
Aug 17, 2024
Merged

Fix a pwdfield bug. #17

merged 1 commit into from
Aug 17, 2024

Conversation

Jo5629
Copy link
Contributor

@Jo5629 Jo5629 commented Aug 16, 2024

CODE:

local gui = flow.widgets

local title = gui.Label{label = "JBanking", align_h = "centre", style = {font = "bold", font_size = "*1.5"}}

jbanking.create_formspec = flow.make_gui(function(player, ctx)
    local buttons_hbox = gui.Hbox{}
    table.insert_all(buttons_hbox, {
        gui.Button{name = "signin", label = "Sign-In Portal", w = 3, h = 1.125,
        on_event = function(player, ctx)
            --jbanking.signin_formspec:show(player)
        end},
        gui.Spacer{},
        gui.Button{name = "new_account", label = "Create", w = 3, h = 1.125,
        on_event = function(player, ctx)
            minetest.chat_send_all(ctx.form["jbanking:username"] .. " | " .. ctx.form["jbanking:password"])
        end},
    })
    return gui.VBox{
        title,
        gui.Label{label = "Account Creation Portal", align_h = "centre", style = {font = "italic", font_size = "*1"}},
        gui.Field{name = "jbanking:username", label = "Username:", h = 1.125},
        gui.Pwdfield{name = "jbanking:password", label = "Password:", h = 1.125},
        buttons_hbox,
    }
end)

jbanking.create_formspec:show(player)

The formspec loads up correctly, but when I try to submit the form, the game crashes and says that there is no jbanking:password. When I change the type from gui.Pwdfield to gui.Field, the formspec runs as normal.

The PR should fix this.

@Lazerbeak12345
Copy link
Contributor

Lazerbeak12345 commented Aug 16, 2024

this bit of advice isn't the cause of the bug (it looks like you're on the right page for fixing it, in fact) but I should point out that style[] elements don't play nice with formspec elements with colons (:) in their name

@Jo5629
Copy link
Contributor Author

Jo5629 commented Aug 16, 2024

this bit of advice isn't the cause of the bug (it looks like you're on the right page for fixing it, in fact) but I should point out that style[] elements don't play nice with formspec elements with colons (:) in their name

Thanks for the info. They are like that because I didn't know what was wrong, so that is just from troubleshooting.

@luk3yx
Copy link
Owner

luk3yx commented Aug 16, 2024

The fix seems reasonable, though sadly MT has no "default" value for pwdfield[] elements, so the value will be lost by the client if the form gets updated.


Something unrelated I've been meaning to bring up: Are you and @Lazerbeak12345 okay with me potentially relicensing flow (and your respective contributions) under LGPL v2.1+ at some point? Flow is currently LGPL v3+, but grorp has asked about using it in the main menu, so I'd like to be able to relicense it if anything more happens there.

I probably don't need permission to relicense small changes like this PR, but asking anyway seems like a good idea.

@luk3yx luk3yx merged commit 38f09be into luk3yx:main Aug 17, 2024
2 checks passed
@luk3yx
Copy link
Owner

luk3yx commented Aug 17, 2024

And thanks for your PR!

@Jo5629
Copy link
Contributor Author

Jo5629 commented Aug 17, 2024

The fix seems reasonable, though sadly MT has no "default" value for pwdfield[] elements, so the value will be lost by the client if the form gets updated.

Something unrelated I've been meaning to bring up: Are you and @Lazerbeak12345 okay with me potentially relicensing flow (and your respective contributions) under LGPL v2.1+ at some point? Flow is currently LGPL v3+, but grorp has asked about using it in the main menu, so I'd like to be able to relicense it if anything more happens there.

I probably don't need permission to relicense small changes like this PR, but asking anyway seems like a good idea.

  1. Yeah I am already experiencing that issue.
  2. I am okay with your request.

@Lazerbeak12345
Copy link
Contributor

Something unrelated I've been meaning to bring up: Are you and @Lazerbeak12345 okay with me potentially relicensing flow (and your respective contributions) under LGPL v2.1+ at some point? Flow is currently LGPL v3+, but grorp has asked about using it in the main menu, so I'd like to be able to relicense it if anything more happens there.

I probably don't need permission to relicense small changes like this PR, but asking anyway seems like a good idea.

A move to bring the licence to match Minetest seems fine to me. I'm alright if my contributions to flow are retroactively changed from LGPLv3_or_higher to LGPLv2.1_or__higher

luk3yx referenced this pull request Aug 28, 2024
I think it's unlikely that flow will be used in the main menu, but now
licensing (hopefully) won't be an issue
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.

3 participants