Commit 7769deb4 authored by jan.koester's avatar jan.koester
Browse files

some fixed \r\n list clientdata

parent aff611f8
Loading
Loading
Loading
Loading
Loading
+31 −1
Changes for src/admin.cpp: 31 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2297,7 +2297,10 @@ namespace authdb {

                        libhtmlpp::HtmlString clistdata;

                        clistdata << "<li>" << cruid << ": " << cdat.getName() << "</li>";
                        clistdata << "<li>" << cruid << ": " << cdat.getName()
                                  << "<a class=\"button\" href=\"/settings/" << cdid << "/"
                                  << "removeclient/" << cruid << "\">Delete</a>"
                                  << "</li>";

                        clist.appendChild(clistdata.parse());

@@ -2327,6 +2330,33 @@ namespace authdb {
            rep.send(curreq,sendat.c_str(),sendat.size());
        }

        void removeClient(libhttppp::HttpRequest *curreq, const int tid, ULONG_PTR args){
            char cdid[255],ccldid[255];
            uuid_t did,cldid;

            if(sscanf(curreq->getRequestURL(),"/settings/%[^/]/removeclient/%s",cdid,ccldid)<0){
                throw AuthBackendError("remove client: wrong url!");
            }

            if(uuid_parse(ccldid,cldid)!=0)
                throw AuthBackendError("remove client: could not parse client uuid!");

            DomainBackend dbackend(_AdminBackend);

            AuthBackend *backend=nullptr;

            if(strcmp(cdid,"admin") == 0 ){
                backend=&_AdminBackend;
            }else if(uuid_parse(cdid,did) == 0 ){
                backend=dbackend.data(did);
            }else{
                throw AuthBackendError("remove client: could not parse uuid!");
            }

            delRecord(*backend,cldid,DataType::ClientData);

        }

        void SettingsController(libhttppp::HttpRequest *curreq, const int tid, ULONG_PTR args){

            libhttppp::HttpCookie cookie;