mirror of https://github.com/gophish/gophish
Previewing Landing pages in a different window seems to work now.
Working on getting some site clone functionality working.pull/24/head
parent
f21d40d77a
commit
4211abe78b
|
@ -1,6 +1,7 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
|
@ -30,7 +31,8 @@ func CreateAdminRouter() http.Handler {
|
|||
router.HandleFunc("/logout", Use(Logout, mid.RequireLogin))
|
||||
router.HandleFunc("/register", Register)
|
||||
router.HandleFunc("/settings", Use(Settings, mid.RequireLogin))
|
||||
router.HandleFunc("/preview", Use(Preview, mid.RequireLogin))
|
||||
router.HandleFunc("/html/preview", Use(Preview, mid.RequireLogin))
|
||||
router.HandleFunc("/html/clone", Use(Clone, mid.RequireLogin))
|
||||
// Create the API routes
|
||||
api := router.PathPrefix("/api").Subrouter()
|
||||
api = api.StrictSlash(true)
|
||||
|
@ -236,7 +238,19 @@ func Preview(w http.ResponseWriter, r *http.Request) {
|
|||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusBadRequest)
|
||||
}
|
||||
getTemplate(w, "dashboard").ExecuteTemplate(w, "base", struct{}{})
|
||||
fmt.Fprintf(w, "%s", r.FormValue("html"))
|
||||
}
|
||||
|
||||
// Clone takes a URL as a POST parameter and returns the site HTML
|
||||
func Clone(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
if r.Method != "POST" {
|
||||
http.Error(w, "Method not allowed", http.StatusBadRequest)
|
||||
}
|
||||
if url, ok := vars["url"]; ok {
|
||||
Logger.Println(url)
|
||||
}
|
||||
http.Error(w, "No URL given.", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
func getTemplate(w http.ResponseWriter, tmpl string) *template.Template {
|
||||
|
|
|
@ -785,6 +785,7 @@ var LandingPageModalCtrl = function($scope, $modalInstance) {
|
|||
$modalInstance.dismiss('')
|
||||
$scope.savePage(page)
|
||||
};
|
||||
$scope.csrf_token = csrf_token
|
||||
};
|
||||
|
||||
app.controller('SettingsCtrl', function($scope, $http, $window) {
|
||||
|
|
|
@ -51,10 +51,10 @@
|
|||
<span class="sr-only">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" style="left:auto; right:0;" role="menu">
|
||||
<li><a ng-click="editTemplate(template)">Edit</a>
|
||||
<li><a ng-click="editPage(page)">Edit</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li><a ng-click="deleteTemplate(template)" ng-href="#">Delete</a>
|
||||
<li><a ng-click="deletePage(page)" ng-href="#">Delete</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<h4 class="modal-title" ng-show="newPage" id="pageModalLabel">New Page</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="/html/preview" method="post" target="_blank">
|
||||
<label class="control-label" for="name">Name:</label>
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" ng-model="page.name" placeholder="Page name" id="name" autofocus/>
|
||||
|
@ -17,18 +18,18 @@
|
|||
</fieldset>
|
||||
<tabset>
|
||||
<tab heading="HTML">
|
||||
<textarea rows="10" class="form-control" ng-model="page.html" placeholder="HTML"></textarea>
|
||||
<textarea rows="10" class="form-control" ng-model="page.html" name="html" placeholder="HTML"></textarea>
|
||||
</tab>
|
||||
<tab heading="Preview">
|
||||
<div ng-model="page.html" contenteditable></div>
|
||||
</tab>
|
||||
</tabset>
|
||||
<br />
|
||||
<fieldset disabled>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-danger btn-disabled"><i class="fa fa-external-link-square"></i> Preview in New Window (Coming Soon!)</button>
|
||||
<button type="submit" class="btn btn-danger btn-disabled"><i class="fa fa-external-link-square"></i> Preview in New Window</button>
|
||||
<input type="hidden" name="csrf_token" value="{{csrf_token}}"/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" ng-click="cancel()">Cancel</button>
|
||||
|
|
Loading…
Reference in New Issue