Improve error message

This commit is contained in:
Yarmo Mackenbach 2022-10-11 15:19:14 +02:00
parent b2b1a1a8d0
commit fe8520b40f
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1

View file

@ -40,59 +40,68 @@ block content
} }
} }
section.profile.narrow.h-card if (data && 'errors' in data && data.errors.length > 0)
noscript section
p Keyoxide requires JavaScript to function. h2 Something went wrong while viewing the profile
.card
if data.errors.length === 1
p The following error was reported:
else
p The following errors were reported:
ul
each error in data.errors
li
p= error
p Please see the
a(href="https://docs.keyoxide.org/getting-started/something-went-wrong/") documentation
| for help.
else
section.profile.narrow.h-card
noscript
p Keyoxide requires JavaScript to function.
dialog#dialog--encryptMessage dialog#dialog--encryptMessage
div div
form(method='post') form(method='post')
label(for="encryptionInput") Message to encrypt label(for="encryptionInput") Message to encrypt
textarea#encryptionInput.input(name='message') textarea#encryptionInput.input(name='message')
input.no-margin(type='submit' name='submit' value='ENCRYPT MESSAGE') input.no-margin(type='submit' name='submit' value='ENCRYPT MESSAGE')
br br
br br
label(for="encryptionOutput") Encryption result label(for="encryptionOutput") Encryption result
textarea#encryptionOutput.output(name='message' placeholder='Waiting for input' readonly) textarea#encryptionOutput.output(name='message' placeholder='Waiting for input' readonly)
form(method="dialog") form(method="dialog")
input(type="submit" value="Close") input(type="submit" value="Close")
dialog#dialog--verifySignature dialog#dialog--verifySignature
div div
form(method='post') form(method='post')
label(for="sigVerInput") Signature label(for="sigVerInput") Signature
textarea#sigVerInput.input(name='signature') textarea#sigVerInput.input(name='signature')
input.no-margin(type='submit' name='submit' value='VERIFY SIGNATURE') input.no-margin(type='submit' name='submit' value='VERIFY SIGNATURE')
br br
br br
label(for="sigVerOutput") Verification result label(for="sigVerOutput") Verification result
textarea#sigVerOutput.output(name='message' placeholder='Waiting for input' readonly) textarea#sigVerOutput.output(name='message' placeholder='Waiting for input' readonly)
form(method="dialog") form(method="dialog")
input(type="submit" value="Close") input(type="submit" value="Close")
dialog#dialog--qr dialog#dialog--qr
div div
canvas#qr canvas#qr
p p
a(href="" tabindex="0")#qr--altLink a(href="" tabindex="0")#qr--altLink
form(method="dialog") form(method="dialog")
input(type="submit" value="Close") input(type="submit" value="Close")
if (isSignature) if (isSignature)
#profileSigInput.form-wrapper.card #profileSigInput.form-wrapper.card
h2 Signature profile h2 Signature profile
form#formGenerateSignatureProfile(method='post') form#formGenerateSignatureProfile(method='post')
label(for="signature") Please enter the raw profile signature below and press "Generate profile". label(for="signature") Please enter the raw profile signature below and press "Generate profile".
textarea#signature(name='signature')= signature textarea#signature(name='signature')= signature
input(type='submit', name='submit', value='Generate profile') input(type='submit', name='submit', value='Generate profile')
if (data && 'errors' in data && data.errors.length > 0)
h2 Something went wrong while generating the profile
ul
each error in data.errors
li= error
else
unless (isSignature && !signature) unless (isSignature && !signature)
#profileHeader.card.card--transparent.card--profileHeader #profileHeader.card.card--transparent.card--profileHeader
img#profileAvatar.u-logo(src=data.extra.avatarURL alt="avatar") img#profileAvatar.u-logo(src=data.extra.avatarURL alt="avatar")