mlmym/templates/login.html
2024-06-02 14:10:53 -04:00

113 lines
3.9 KiB
HTML

<!DOCTYPE html>
<head>
<title>{{ host .Host }}: sign up or log in</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="/{{.Host}}/icon.jpg">
<link rel="stylesheet" href="/_/static/style.css?v={{ .Version }}">
{{- if or (not .Dark) (is .Dark) }}
<link rel="stylesheet" href="/_/static/dark.css?v={{ .Version }}" {{ if not .Dark }}media="(prefers-color-scheme:dark)"{{ end }}>
{{- end }}
</head>
<body>
<nav>
<div class="communities">
<a href="/{{.Host}}">home</a>
<span> - </span>
<a href="/{{.Host}}?listingType=All">all</a>
|
{{ $host := .Host }}
{{ range $i, $c := .TopCommunities}}
<a href="/{{$host}}/c/{{$c.Community.Name}}">{{$c.Community.Name}}</a>
<span> - </span>
{{ end }}
<a href="/{{$host}}/search?searchtype=Communities" class="more">more »</a>
</div>
<div class="spacer">
<a href="/{{ .Host}}/">
<img class="icon" src="{{ if and .Site .Site.SiteView.Site.Icon.IsValid }}{{ shrink .Site.SiteView.Site.Icon.String }}{{else}}/{{ .Host}}/icon.jpg{{end}}">
</a>
</div>
<a class="title" href="/{{.Host}}">{{ host .Host}}</a><span class="title"> - sign up or login</span>
<span class="spacer"></span>
</nav>
{{ if .Alert }}
<div class="alert">
{{ .Alert }}
</div>
{{ end }}
{{ if .Error }}
<div class="error">{{.Error}}</div>
{{ end }}
<div class="signup">
{{ if ne .Op "2fa" }}
<div>
<h2>create a new account</h2>
<form method="POST" action="/{{ .Host}}/login">
<label>
username
<div><input required name="username" type="text"></div>
</label>
<label>
password
<div><input required name="password" type="password"></div>
</label>
<label>
verify password
<div><input required name="passwordverify" type="password"></div>
</label>
<label>
email
<div><input {{ if and .Site .Site.SiteView.LocalSite.RequireEmailVerification }} required {{ end }}name="email" type="text"></div>
</label>
{{ if and .Site (or (eq .Site.SiteView.LocalSite.RegistrationMode "RequireApplication") (eq .Site.SiteView.LocalSite.RegistrationMode "requireapplication")) }}
<div class="question">
{{ markdown .Host .Site.SiteView.LocalSite.ApplicationQuestion.String }}
</div>
<label>
answer
<div><textarea required name="answer"></textarea></div>
</label>
{{ end }}
{{ if and .Site .Site.SiteView.LocalSite.CaptchaEnabled .Captcha }}
<figure><img src="data:image/png;base64,{{ .Captcha.PNG }}"></figure>
<figure><audio controls src="data:audio/wav;base64,{{ .Captcha.WAV }}"></audio></figure>
<label>
enter code
<div><input required name="captchaanswer" type="text"></div>
<input type="hidden" name="captchauuid" value="{{ .Captcha.UUID }}">
</label>
{{ end }}
{{ if and .Site .Site.SiteView.LocalSite.EnableNSFW }}
<label>
enable nsfw
<input type="checkbox">
</label>
{{ end }}
<input type="submit" name="submit" value="sign up">
</form>
</div>
{{ end }}
<div>
<h2>login</h2>
<form method="POST" action="/{{ .Host}}/login">
<label>
username
<div><input required name="username" type="text"></div>
</label>
<label>
password
<div><input required name="password" type="password"></div>
</label>
{{ if eq .Op "2fa" }}
<label>
2fa code
<div><input required name="totp" type="text"></div>
</label>
{{ end }}
<input type="submit" name="submit" value="log in">
</form>
</div>
</div>
</body>
</html>