ContainerImage.Pinniped/internal/testutil/loginhtml.go

65 lines
14 KiB
Go
Raw Normal View History

// Copyright 2022 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package testutil
import (
"fmt"
"go.pinniped.dev/internal/here"
)
func ExpectedLoginPageHTML(wantCSS, wantIDPName, wantPostPath, wantEncodedState, wantAlert string) string {
alertHTML := ""
if wantAlert != "" {
alertHTML = fmt.Sprintf("\n"+
" <div class=\"form-field\">\n"+
" <span class=\"alert\" role=\"alert\" aria-label=\"login error message\" id=\"alert\">%s</span>\n"+
" </div>\n ",
wantAlert,
)
}
return here.Docf(`<!DOCTYPE html>
<html lang="en">
<head>
<title>Pinniped Login</title>
<meta charset="UTF-8">
<style>%s</style>
<link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAAGoAAABqCAYAAABUIcSXAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAaqADAAQAAAABAAAAagAAAADRr5i2AAAkJ0lEQVR4AdU9B3gVVdZnXnrvAVIJJbRAgIQSiiBSBAXFCoq46gIqLr8kIcCuulFXpARZFxvNgii6NAEFlSKrBEJNQgmEBAiQAgkhvSdv/nMmzGPezJ3X8gLxfN98c8u5596ZM/fec8899wwHf1JITEx0ra6uDuZ5Pphv4v15TuPM8VpnAI2TFrQaDWgqgIcKXgMVAFwFx2lK7ewg+/333y/+Mz4y19YbjYzgFsQt6NMA2ihsbF8Avh+++F6Y7mVJ2zngioHjM4GDTE6rOcfZ8oe6dOlydNasWQ2W0LtbZdokoxISEoK0jdrxPA+jkSkP8MD7tOYL4Tio4oH7Q8Nz+5Fx+5YtW3ayNeuzhHabYdTChQv96mubnkSmTMFeMwwf5p61jeO4i9iOr+3tbb9evHjxJUterLXL3LOXIT5IXNz8YTyvnYMNmYzDma2Y3lbu2NsOcrzmy5CwoA1z5sypu1ftuieMQkFAU1FRPZXX8r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v9vIkIV5RUg1r4n+C0/+7xMxvC4mkNnr4xCVIKWX3/n7uzorlSRUy9nQFe54Sn2k0GvWoghZelOfpMYq0ENirp8iRxPj99480uEubm1kEDXX6c49Gw8H0d8fBxNlDgMRxOTSgBPXdot/gN1wYtzX4vaQSJp68BDk17PXUY+
rel="icon" type="image/x-icon"/>
</head>
<body>
<div class="box" aria-label="login form" role="main">
<div class="form-field">
<h1>Log in to %s</h1>
</div>
%s
<form action="%s" method="post">
<input type="hidden" name="state" id="state" value="%s">
<div class="form-field">
<label for="username"><span class="hidden" aria-hidden="true">Username</span></label>
<input type="text" name="username" id="username"
autocomplete="username" placeholder="Username" required>
</div>
<div class="form-field">
<label for="password"><span class="hidden" aria-hidden="true">Password</span></label>
<input type="password" name="password" id="password"
autocomplete="current-password" placeholder="Password" required>
</div>
<div class="form-field">
<input type="submit" name="submit" id="submit" value="Log in"/>
</div>
</form>
</div>
</body>
</html>
`,
wantCSS,
wantIDPName,
alertHTML,
wantPostPath,
wantEncodedState,
)
}