Restricted registration to only logged in users. Fixes #137

pull/140/head
Jordan Wright 2016-02-09 22:19:06 -06:00
parent 5e11895c23
commit fdfeafa1ec
3 changed files with 9 additions and 3 deletions

View File

@ -35,7 +35,7 @@ func CreateAdminRouter() http.Handler {
router.HandleFunc("/templates", Use(Templates, mid.RequireLogin)) router.HandleFunc("/templates", Use(Templates, mid.RequireLogin))
router.HandleFunc("/users", Use(Users, mid.RequireLogin)) router.HandleFunc("/users", Use(Users, mid.RequireLogin))
router.HandleFunc("/landing_pages", Use(LandingPages, mid.RequireLogin)) router.HandleFunc("/landing_pages", Use(LandingPages, mid.RequireLogin))
router.HandleFunc("/register", Register) router.HandleFunc("/register", Use(Register, mid.RequireLogin))
router.HandleFunc("/settings", Use(Settings, mid.RequireLogin)) router.HandleFunc("/settings", Use(Settings, mid.RequireLogin))
// Create the API routes // Create the API routes
api := router.PathPrefix("/api").Subrouter() api := router.PathPrefix("/api").Subrouter()

View File

@ -56,7 +56,6 @@
<input type="password" name="password" class="form-control" placeholder="Password" required> <input type="password" name="password" class="form-control" placeholder="Password" required>
<input type="hidden" name="csrf_token" value="{{.Token}}"/> <input type="hidden" name="csrf_token" value="{{.Token}}"/>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button> <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
<a href="/register" class="btn btn-sm btn-info btn-block">Create new account</a>
</form> </form>
</div> </div>
<!-- Placed at the end of the document so the pages load faster --> <!-- Placed at the end of the document so the pages load faster -->

View File

@ -26,6 +26,13 @@
<h1 class="page-header">Settings</h1> <h1 class="page-header">Settings</h1>
</div> </div>
<div id="flashes" class="row"></div> <div id="flashes" class="row"></div>
<div class="row">
<label class="col-sm-2 control-label form-label">Register a New User</label>
<div class="col-md-6">
<a href="/register" class="btn btn-primary"><i class="fa fa-plus"></i> Add User</a>
</div>
</div>
<br/>
<div class="row"> <div class="row">
<label for="api_key" class="col-sm-2 control-label form-label">API Key:</label> <label for="api_key" class="col-sm-2 control-label form-label">API Key:</label>
<div class="col-md-6"> <div class="col-md-6">
@ -60,7 +67,7 @@
</div> </div>
<input type="hidden" name="csrf_token" value="{{.Token}}"/> <input type="hidden" name="csrf_token" value="{{.Token}}"/>
<br /> <br />
<button class="btn btn-primary" type="submit">Save</button> <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> Save</button>
</form> </form>
<br/> <br/>
</div> </div>