Commit 11139a32 authored by jan.koester's avatar jan.koester
Browse files

check if username set

parent a3e1ed93
Loading
Loading
Loading
Loading
Loading
+8 −0
Changes for src/admin.cpp: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -169,6 +169,8 @@ namespace authdb {
                uuid_generate(uid);
                class UserData udat(uid);

                bool username=false;

                for (libhttppp::HttpForm::MultipartForm::Data* curformdat = curform.MultipartFormData.getFormData();
                     curformdat; curformdat = curformdat->nextData()) {

@@ -234,6 +236,8 @@ namespace authdb {
                        udat.Data->append(cudat);
                        delete[] cudat.data;
                    }else if(cudat.storage==TextStorage){
                        if(strcmp(cudat.fieldname,"username")==0)
                            username=true;
                        if(strcmp(cudat.fieldname,"pwhash")==0){
                            Hash hash;
                            std::string pwhash,inpw;
@@ -271,6 +275,10 @@ namespace authdb {
                    }

                }

                if(!username)
                    throw AuthBackendError("username not set !");

                User user;
                user.create(*backend,&udat);
                std::cout << "user created!" << std::endl;