mirror of
https://github.com/writefreely/writefreely
synced 2024-11-10 11:24:13 +00:00
Support ?landing=1 to always show landing page
This supports admins previewing changes to the landing page. Ref T565
This commit is contained in:
parent
6fdc343986
commit
aedb05080c
2 changed files with 19 additions and 12 deletions
7
app.go
7
app.go
|
@ -186,6 +186,9 @@ func handleViewHome(app *App, w http.ResponseWriter, r *http.Request) error {
|
|||
}
|
||||
|
||||
// Multi-user instance
|
||||
forceLanding := r.FormValue("landing") == "1"
|
||||
if !forceLanding {
|
||||
// Show correct page based on user auth status and configured landing path
|
||||
u := getUserSession(app, r)
|
||||
if u != nil {
|
||||
// User is logged in, so show the Pad
|
||||
|
@ -195,12 +198,16 @@ func handleViewHome(app *App, w http.ResponseWriter, r *http.Request) error {
|
|||
if land := app.cfg.App.LandingPath(); land != "/" {
|
||||
return impart.HTTPError{http.StatusFound, land}
|
||||
}
|
||||
}
|
||||
|
||||
p := struct {
|
||||
page.StaticPage
|
||||
Flashes []template.HTML
|
||||
|
||||
ForcedLanding bool
|
||||
}{
|
||||
StaticPage: pageForReq(app, r),
|
||||
ForcedLanding: forceLanding,
|
||||
}
|
||||
|
||||
// Get error messages
|
||||
|
|
|
@ -76,20 +76,20 @@ form dd {
|
|||
<label>
|
||||
<dt>Username</dt>
|
||||
<dd>
|
||||
<input type="text" id="alias" name="alias" style="width: 100%; box-sizing: border-box;" tabindex="1" autofocus />
|
||||
<input type="text" id="alias" name="alias" style="width: 100%; box-sizing: border-box;" tabindex="1" autofocus {{if .ForcedLanding}}disabled{{end}} />
|
||||
{{if .Federation}}<p id="alias-site" class="demo">@<strong>your-username</strong>@{{.FriendlyHost}}</p>{{else}}<p id="alias-site" class="demo">{{.FriendlyHost}}/<strong>your-username</strong></p>{{end}}
|
||||
</dd>
|
||||
</label>
|
||||
<label>
|
||||
<dt>Password</dt>
|
||||
<dd><input type="password" id="password" name="pass" autocomplete="new-password" placeholder="" tabindex="2" style="width: 100%; box-sizing: border-box;" /></dd>
|
||||
<dd><input type="password" id="password" name="pass" autocomplete="new-password" placeholder="" tabindex="2" style="width: 100%; box-sizing: border-box;" {{if .ForcedLanding}}disabled{{end}} /></dd>
|
||||
</label>
|
||||
<label>
|
||||
<dt>Email (optional)</dt>
|
||||
<dd><input type="email" name="email" id="email" style="letter-spacing: 1px; width: 100%; box-sizing: border-box;" placeholder="me@example.com" tabindex="3" /></dd>
|
||||
<dd><input type="email" name="email" id="email" style="letter-spacing: 1px; width: 100%; box-sizing: border-box;" placeholder="me@example.com" tabindex="3" {{if .ForcedLanding}}disabled{{end}} /></dd>
|
||||
</label>
|
||||
<dt>
|
||||
<button id="btn-create" type="submit" style="margin-top: 0">Create blog</button>
|
||||
<button id="btn-create" type="submit" style="margin-top: 0" {{if .ForcedLanding}}disabled{{end}}>Create blog</button>
|
||||
</dt>
|
||||
</dl>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue