Commit b089f3c8 authored by Eelco van der Wel's avatar Eelco van der Wel 💬
Browse files

add CVU, add authEmail to Account schema init

parent ace83847
Showing with 67 additions and 5 deletions
+67 -5
......@@ -43,10 +43,10 @@ def run_qr_flow(_qr_code_data, client: PodClient, plugin_run: PluginRun):
# Gather email
plugin_run.status = RUN_USER_ACTION_NEEDED
pwd_cvu = get_default_cvu("request_password.cvu")
email_cvu = get_default_cvu("request_email.cvu")
client.bulk_action(
create_items=[pwd_cvu],
create_edges=[Edge(plugin_run, pwd_cvu, "view")]
create_items=[email_cvu],
create_edges=[Edge(plugin_run, email_cvu, "view")]
)
client.update_item(plugin_run)
......@@ -66,9 +66,10 @@ def run_qr_flow(_qr_code_data, client: PodClient, plugin_run: PluginRun):
email_sent = False
print(f"failed to send email:\n{e}")
# set
# depending on whether email was a success, either show qr link, or message that link was sent to email
if not email_sent:
# NOTE Theres currently no documented way to delete edges, so client will have to pick the last added cvu.
client.bulk_action(delete_items=[email_cvu])
cvu = get_default_cvu("qr_code_auth.cvu")
client.create(cvu)
plugin_run.add_edge("view", cvu)
......
.request-email {
title: "WhatsApp integration"
defaultRenderer: generalEditor
showContextualBottomBar: false
showBottomBar: false
showDefaultLayout: false
readOnly: false
[renderer = generalEditor] {
layout: [
{ section: info}
{ section: e-mail, fields: authEmail }
{ section: send }
]
info {
showTitle: false
HStack {
Text {
text: "Please enter your email, we will send you a link to authenticate the plugin"
font: 20 semibold
color: #000
padding: 5 8 5 8
}
}
}
send {
showTitle: false
HStack {
alignment: center
Spacer
Button {
padding: 20 0 20 0
onPress: [
setProperty {
subject: {{.~account}}
property: "status"
value: "ready"
}
sync
back
]
VStack {
background: #218721
cornerRadius: 5
Text {
text: "Send"
font: 16 semibold
color: #fff
padding: 5 8 5 8
}
}
}
Spacer
}
}
}
}
\ No newline at end of file
......@@ -63,7 +63,7 @@ class PodClient:
PluginRun("", "", "", status="", error="", targetItemId="", settings="", authUrl=""),
CVUStoredDefinition(name="", definition="", externalId=""),
Account(service="", identifier="", secret="", code="", accessToken="",
refreshToken="", errorMessage="", handle="", displayName=""),
refreshToken="", errorMessage="", handle="", displayName="", authEmail=""),
Photo(width=1,height=1,channels=1,encoding="")
)
except Exception as e:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment