Merge pull request #140 from gophish/137-restrict-registration

Restricted registration to only logged in users.
pull/147/head
Jordan Wright 2016-02-09 22:24:04 -06:00
commit ef8d9c282b
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("/users", Use(Users, 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))
// Create the API routes
api := router.PathPrefix("/api").Subrouter()

View File

@ -56,7 +56,6 @@
<input type="password" name="password" class="form-control" placeholder="Password" required>
<input type="hidden" name="csrf_token" value="{{.Token}}"/>
<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>
</div>
<!-- Placed at the end of the document so the pages load faster -->

View File

@ -26,6 +26,13 @@
<h1 class="page-header">Settings</h1>
</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">
<label for="api_key" class="col-sm-2 control-label form-label">API Key:</label>
<div class="col-md-6">
@ -60,7 +67,7 @@
</div>
<input type="hidden" name="csrf_token" value="{{.Token}}"/>
<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>
<br/>
</div>