Node.js

Create the UI

The application will use the pug template engine to render the pages as HTML.

In a folder called views in your application directory, create the following templates:

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!')

Finally, create a file called style.css in a public/css directory, which contains the following style sheet: