From fe8520b40fa9fe3e2f65d83c72bb409a005ca97b Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Tue, 11 Oct 2022 15:19:14 +0200 Subject: [PATCH] Improve error message --- views/profile.pug | 105 +++++++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 48 deletions(-) diff --git a/views/profile.pug b/views/profile.pug index 3fa2c0f..6c72c3d 100644 --- a/views/profile.pug +++ b/views/profile.pug @@ -40,59 +40,68 @@ block content } } - section.profile.narrow.h-card - noscript - p Keyoxide requires JavaScript to function. + if (data && 'errors' in data && data.errors.length > 0) + section + 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 - div - form(method='post') - label(for="encryptionInput") Message to encrypt - textarea#encryptionInput.input(name='message') - input.no-margin(type='submit' name='submit' value='ENCRYPT MESSAGE') - br - br - label(for="encryptionOutput") Encryption result - textarea#encryptionOutput.output(name='message' placeholder='Waiting for input' readonly) - form(method="dialog") - input(type="submit" value="Close") + dialog#dialog--encryptMessage + div + form(method='post') + label(for="encryptionInput") Message to encrypt + textarea#encryptionInput.input(name='message') + input.no-margin(type='submit' name='submit' value='ENCRYPT MESSAGE') + br + br + label(for="encryptionOutput") Encryption result + textarea#encryptionOutput.output(name='message' placeholder='Waiting for input' readonly) + form(method="dialog") + input(type="submit" value="Close") - dialog#dialog--verifySignature - div - form(method='post') - label(for="sigVerInput") Signature - textarea#sigVerInput.input(name='signature') - input.no-margin(type='submit' name='submit' value='VERIFY SIGNATURE') - br - br - label(for="sigVerOutput") Verification result - textarea#sigVerOutput.output(name='message' placeholder='Waiting for input' readonly) - form(method="dialog") - input(type="submit" value="Close") + dialog#dialog--verifySignature + div + form(method='post') + label(for="sigVerInput") Signature + textarea#sigVerInput.input(name='signature') + input.no-margin(type='submit' name='submit' value='VERIFY SIGNATURE') + br + br + label(for="sigVerOutput") Verification result + textarea#sigVerOutput.output(name='message' placeholder='Waiting for input' readonly) + form(method="dialog") + input(type="submit" value="Close") - dialog#dialog--qr - div - canvas#qr - p - a(href="" tabindex="0")#qr--altLink - form(method="dialog") - input(type="submit" value="Close") + dialog#dialog--qr + div + canvas#qr + p + a(href="" tabindex="0")#qr--altLink + form(method="dialog") + input(type="submit" value="Close") - if (isSignature) - #profileSigInput.form-wrapper.card - h2 Signature profile - form#formGenerateSignatureProfile(method='post') - label(for="signature") Please enter the raw profile signature below and press "Generate profile". - textarea#signature(name='signature')= signature - input(type='submit', name='submit', value='Generate profile') + if (isSignature) + #profileSigInput.form-wrapper.card + h2 Signature profile + form#formGenerateSignatureProfile(method='post') + label(for="signature") Please enter the raw profile signature below and press "Generate profile". + textarea#signature(name='signature')= signature + 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) #profileHeader.card.card--transparent.card--profileHeader img#profileAvatar.u-logo(src=data.extra.avatarURL alt="avatar")