Node.js

Erstellen Sie die UI

Die Anwendung verwendet die pug Template-Engine um die Seiten als HTML zu rendern.

In einem Ordner namens views in Ihrem Anwendungsverzeichnis, erstellen Sie die folgenden Vorlagen:

layout.pug

doctype html
html
    head
        block head 
            meta(charset='utf-8')
            title Step-up Authentication Example
            link(rel='stylesheet', type='text/css', href='/css/style.css')
            link(href='https://fonts.googleapis.com/css?family=Open+Sans:300', rel='stylesheet', type='text/css')
    body
        block content
            .container

index.pug

extends layout.pug

block content
    h1 #{brand} Account Management!
    if number
        p You have verified your identity using the phone number #{number} and are now permitted to make changes to your account.
        a(href="cancel")
            button.ghost-button(type="button") Cancel
    else
        p Please verify your account to make changes to your settings.
        a(href="authenticate")
            button.ghost-button(type="button") Verify me

authenticate.pug

extends layout.pug

block content
    h1 Account Verification: Step 1
    fieldset
        form(action='/verify', method='post')
            input.ghost-input(name='number', type='text', placeholder='Enter your mobile number', required='')
            input.ghost-button(type='submit', value='Get Verification Code')

entercode.pug

extends layout.pug

block content
    h1 Account Verification: Step 2
    fieldset
        form(action='/check-code', method='post')
            input.ghost-input(name='code', type='text', placeholder='Enter your verification code', required='')
            input.ghost-button(type='submit', value='Verify me!')

Erstellen Sie schließlich eine Datei namens style.css in einem public/css Verzeichnis, das die folgende Formatvorlage enthält: