mirror of
				https://github.com/optim-enterprises-bv/databunker.git
				synced 2025-11-03 19:37:48 +00:00 
			
		
		
		
	Ask for reason before executing the operation
This commit is contained in:
		@@ -284,6 +284,12 @@ func (e mainEnv) cancelUserRequest(w http.ResponseWriter, r *http.Request, ps ht
 | 
			
		||||
	if enforceUUID(w, request, event) == false {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	records, err := getJSONPostData(r)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		returnError(w, r, "failed to decode request body", 405, err, event)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	reason := getStringValue(records, "reason");
 | 
			
		||||
	requestInfo, err := e.db.getRequest(request)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		returnError(w, r, "internal error", 405, err, event)
 | 
			
		||||
@@ -315,8 +321,7 @@ func (e mainEnv) cancelUserRequest(w http.ResponseWriter, r *http.Request, ps ht
 | 
			
		||||
		returnError(w, r, "not found", 405, err, event)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	reason := ""
 | 
			
		||||
	if authResult == "login" {
 | 
			
		||||
	if len(reason) == 0 && authResult == "login" {
 | 
			
		||||
		reason = "user operation"
 | 
			
		||||
	}
 | 
			
		||||
	e.db.updateRequestStatus(request, "canceled", reason)
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,11 @@
 | 
			
		||||
          <label for="reason" class="col-sm-3 col-form-label">Reason</label>
 | 
			
		||||
          <div class="col-sm-9"><textarea class="form-control" id="reason" rows="2"></textarea>
 | 
			
		||||
          </div></div></form>`;
 | 
			
		||||
        var btn = `<button type="submit" class="btn btn-primary" id="submitButton">Approve</button>`;
 | 
			
		||||
	var bTitle = 'Approve';
 | 
			
		||||
	if (action == "cancel") {
 | 
			
		||||
          bTitle = 'Reject';
 | 
			
		||||
	}
 | 
			
		||||
        var btn = `<button type="submit" class="btn btn-primary" id="submitButton">`+bTitle+`</button>`;
 | 
			
		||||
        var modal = showForm(title0, form, btn);
 | 
			
		||||
        modal.find('#submitButton').click(function (event) {
 | 
			
		||||
	  modal.modal('hide');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user