<%
include("../wsUtil.jag");
var util = require("../../util/utility.jag");
var log = new Log();
var serverUrl = util.getServerUrl();
serverUrl = serverUrl + "/FIDOService";

var ws = require('ws');
var webService = new ws.WSRequest();

function init(){

    var cookie = session.get('auth-cookie');
        if(cookie == null){
        var cookie = request.getParameter("cookie");
        session.put('auth-cookie', cookie);
        }
    var username = request.getParameter("user");
    var deviceRemarks = request.getParameter("deviceRemarks");

        try{

if(deviceRemarks == null){

            var result = callWSInOnlyWithParams(webService, serverUrl, "urn:removeAllRegistrations", new Array(username, "https://localhost:9443"));
}
else{

            var result = callWSInOnlyWithParams(webService, serverUrl, "urn:removeRegistration", new Array( deviceRemarks ));	
}

        } catch(e){
            log.error(e);
            response.sendRedirect("../../index.jag?e=1&error=" + e);
        }
}

init();

%>
