remove delete button
This commit is contained in:
parent
3aef75a73e
commit
dadde0cc89
3 changed files with 0 additions and 32 deletions
|
@ -88,7 +88,6 @@
|
|||
<th style="width: 50%">Description</th>
|
||||
<th style="width: 20%">Created at</th>
|
||||
<th style="width: 20%">Ended at</th>
|
||||
<th style="width: 20%">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
@ -99,12 +98,6 @@
|
|||
<td>{{ $session.Description }}</td>
|
||||
<td>{{ $session.CreatedAt.Format "02.01.2006 15:04:05" }}</td>
|
||||
<td>{{ $session.EndedAt.Format "02.01.2006 15:04:05" }}</td>
|
||||
<td>
|
||||
<form method="post" action="/delete_session" enctype="multipart/form-data">
|
||||
<input type="hidden" name="session_id" value="{{ $session.Id }}">
|
||||
<input type="submit" value="Delete" class="secondary">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
|
|
1
main.go
1
main.go
|
@ -48,7 +48,6 @@ func Run() error {
|
|||
mux.Handle("GET /", routes.GetIndex(device, storage, tmpl))
|
||||
mux.Handle("POST /start_session", routes.StartSession(logger, storage))
|
||||
mux.Handle("POST /end_session", routes.EndSession(logger, storage))
|
||||
mux.Handle("POST /delete_session", routes.DeleteSession(logger, storage))
|
||||
|
||||
mux.Handle("POST /api/session", routes.APIStartSession(logger, storage))
|
||||
mux.Handle("DELETE /api/session/{session_id}", routes.APIEndSession(logger, storage))
|
||||
|
|
|
@ -83,27 +83,3 @@ func EndSession(logger *log.Logger, storage sessions.Storage) http.HandlerFunc {
|
|||
logger.Printf("Ended session for %s via webpanel (id = %s)", req.RemoteAddr, sessionId)
|
||||
}
|
||||
}
|
||||
|
||||
func DeleteSession(logger *log.Logger, storage sessions.Storage) http.HandlerFunc {
|
||||
return func(res http.ResponseWriter, req *http.Request) {
|
||||
err := req.ParseMultipartForm(10 * 1024)
|
||||
if err != nil {
|
||||
http.Error(res, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
sessionId := req.FormValue("session_id")
|
||||
err = storage.DeleteSession(sessionId)
|
||||
switch {
|
||||
case err == sessions.ErrUnknownSession:
|
||||
http.Error(res, "", http.StatusNotFound)
|
||||
return
|
||||
case err != nil:
|
||||
http.Error(res, "", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
http.Redirect(res, req, "/", http.StatusFound)
|
||||
logger.Printf("Deleted session for %s via webpanel (id = %s)", req.RemoteAddr, sessionId)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue