Add prompt, more resizing
This commit is contained in:
+40
-1
@@ -355,7 +355,46 @@ challenge(State = #s{recvr = PID, keys = #w{wx = KeyP}}, Challenge) ->
|
||||
State;
|
||||
KeyID ->
|
||||
PubKey = list_to_binary(KeyID),
|
||||
handle_challenge(State, PubKey, Challenge)
|
||||
prompt_challenge(State, PubKey, Challenge)
|
||||
end.
|
||||
|
||||
prompt_challenge(State = #s{recvr = PID, frame = Frame, j = J}, PubKey, Challenge) ->
|
||||
Dialog = wxDialog:new(Frame, ?wxID_ANY, J("Message Signature Request")),
|
||||
Sizer = wxBoxSizer:new(?wxVERTICAL),
|
||||
Instruction = J("GajuExpress is requesting an authentication signature."),
|
||||
InstTx = wxStaticText:new(Dialog, ?wxID_ANY, Instruction),
|
||||
AcctSz = wxStaticBoxSizer:new(?wxVERTICAL, Dialog, [{label, J("Signature Account")}]),
|
||||
AcctTx = wxStaticText:new(Dialog, ?wxID_ANY, PubKey),
|
||||
_ = wxStaticBoxSizer:add(AcctSz, AcctTx, zxw:flags({wide, 5})),
|
||||
MessSz = wxStaticBoxSizer:new(?wxVERTICAL, Dialog, [{label, J("Message")}]),
|
||||
MessStyle = ?wxTE_MULTILINE bor ?wxTE_READONLY,
|
||||
MessTx = wxTextCtrl:new(Dialog, ?wxID_ANY, [{value, Challenge}, {style, MessStyle}]),
|
||||
_ = wxStaticBoxSizer:add(MessSz, MessTx, zxw:flags({wide, 5})),
|
||||
ButtSz = wxBoxSizer:new(?wxHORIZONTAL),
|
||||
Affirm = wxButton:new(Dialog, ?wxID_OK),
|
||||
Cancel = wxButton:new(Dialog, ?wxID_CANCEL),
|
||||
_ = wxBoxSizer:add(ButtSz, Affirm, zxw:flags({wide, 5})),
|
||||
_ = wxBoxSizer:add(ButtSz, Cancel, zxw:flags({wide, 5})),
|
||||
_ = wxBoxSizer:add(Sizer, InstTx, zxw:flags({base, 5})),
|
||||
_ = wxBoxSizer:add(Sizer, AcctSz, zxw:flags({base, 5})),
|
||||
_ = wxBoxSizer:add(Sizer, MessSz, zxw:flags({wide, 5})),
|
||||
_ = wxBoxSizer:add(Sizer, ButtSz, zxw:flags(base)),
|
||||
ok = wxDialog:setSizer(Dialog, Sizer),
|
||||
ok = wxDialog:setSize(Dialog, {600, 300}),
|
||||
ok = wxBoxSizer:layout(Sizer),
|
||||
ok = wxFrame:center(Dialog),
|
||||
Outcome =
|
||||
case wxDialog:showModal(Dialog) of
|
||||
?wxID_OK -> ok;
|
||||
?wxID_CANCEL -> cancel
|
||||
end,
|
||||
ok = wxDialog:destroy(Dialog),
|
||||
case Outcome of
|
||||
ok ->
|
||||
handle_challenge(State, PubKey, Challenge);
|
||||
cancel ->
|
||||
ok = gd_n_recvr:stop(PID),
|
||||
State
|
||||
end.
|
||||
|
||||
handle_challenge(State = #s{recvr = PID}, PubKey, Challenge) ->
|
||||
|
||||
Reference in New Issue
Block a user