Loading src/authdb.cpp +33 −3 Changes for src/authdb.cpp: 33 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include "authdb.h" #include "user.h" #include "types.h" #include "hash.h" namespace authdb { Loading Loading @@ -176,6 +177,17 @@ namespace authdb { cudat.data=new char[cudat.datasize]; memcpy(cudat.data,curformdat->Value.data(), cudat.datasize); }else{ if(strcmp(cudat.fieldname,"pwhash")==0){ Hash hash; std::string pwhash,inpw; std::copy(curformdat->Value.begin(),curformdat->Value.end(), std::back_inserter(inpw)); hash.hash(inpw,pwhash); cudat.datasize=pwhash.length()+1; cudat.data=new char[cudat.datasize]; memcpy(cudat.data,pwhash.c_str(),pwhash.length()); cudat.data[pwhash.length()]='\0'; }else{ cudat.datasize=curformdat->Value.size()+1; cudat.data=new char[cudat.datasize]; Loading @@ -183,6 +195,7 @@ namespace authdb { curformdat->Value.size()); cudat.data[curformdat->Value.size()]='\0'; } } udat.Data->append(cudat); delete[] cudat.data; Loading @@ -209,6 +222,8 @@ namespace authdb { << "<td><input type=\"text\" name=\"lastname\"></td></tr>" << "<tr><td><label for=\"mail\">mail:</label></td>" << "<td><input type=\"text\" name=\"mail\"></td></tr>" << "<tr><td><label for=\"pwhash\">password:</label></td>" << "<td><input type=\"text\" name=\"pwhash\"></td></tr>" << "<tr><td><label for=\"avatar\">ProfilBild:</label></td>" << "<td><input type=\"file\" name=\"avatar\"></td></tr>" << "<tr><td></td><td><input type=\"submit\"></td></tr>" Loading Loading @@ -346,11 +361,26 @@ namespace authdb { } } curec.Data->datasize=curformdat->Value.size(); if(curec.Data->storage==TextStorage && strcmp(curec.Data->fieldname,"pwhash")==0){ Hash hash; std::string pwhash,inpw; std::copy(curformdat->Value.begin(),curformdat->Value.end(), std::back_inserter(inpw)); hash.hash(inpw,pwhash); curec.Data->datasize=pwhash.length()+1; curec.Data->data=new char[curec.Data->datasize]; memcpy(curec.Data->data,pwhash.c_str(),pwhash.length()); curec.Data->data[pwhash.length()]='\0'; }else{ curec.Data->datasize=curformdat->Value.size()+1; curec.Data->data=new char[curec.Data->datasize]; memcpy(curec.Data->data,curformdat->Value.data(),curformdat->Value.size()); memcpy(curec.Data->data,curformdat->Value.data(), curformdat->Value.size()); curec.Data->data[curformdat->Value.size()]='\0'; } editrec.append(curec); delete[] curec.Data->data; } } Loading src/hash.h +1 −0 Changes for src/hash.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ namespace authdb{ }; class Hash{ public: void hash(const std::string input,std::string &out); }; } Loading
src/authdb.cpp +33 −3 Changes for src/authdb.cpp: 33 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ #include "authdb.h" #include "user.h" #include "types.h" #include "hash.h" namespace authdb { Loading Loading @@ -176,6 +177,17 @@ namespace authdb { cudat.data=new char[cudat.datasize]; memcpy(cudat.data,curformdat->Value.data(), cudat.datasize); }else{ if(strcmp(cudat.fieldname,"pwhash")==0){ Hash hash; std::string pwhash,inpw; std::copy(curformdat->Value.begin(),curformdat->Value.end(), std::back_inserter(inpw)); hash.hash(inpw,pwhash); cudat.datasize=pwhash.length()+1; cudat.data=new char[cudat.datasize]; memcpy(cudat.data,pwhash.c_str(),pwhash.length()); cudat.data[pwhash.length()]='\0'; }else{ cudat.datasize=curformdat->Value.size()+1; cudat.data=new char[cudat.datasize]; Loading @@ -183,6 +195,7 @@ namespace authdb { curformdat->Value.size()); cudat.data[curformdat->Value.size()]='\0'; } } udat.Data->append(cudat); delete[] cudat.data; Loading @@ -209,6 +222,8 @@ namespace authdb { << "<td><input type=\"text\" name=\"lastname\"></td></tr>" << "<tr><td><label for=\"mail\">mail:</label></td>" << "<td><input type=\"text\" name=\"mail\"></td></tr>" << "<tr><td><label for=\"pwhash\">password:</label></td>" << "<td><input type=\"text\" name=\"pwhash\"></td></tr>" << "<tr><td><label for=\"avatar\">ProfilBild:</label></td>" << "<td><input type=\"file\" name=\"avatar\"></td></tr>" << "<tr><td></td><td><input type=\"submit\"></td></tr>" Loading Loading @@ -346,11 +361,26 @@ namespace authdb { } } curec.Data->datasize=curformdat->Value.size(); if(curec.Data->storage==TextStorage && strcmp(curec.Data->fieldname,"pwhash")==0){ Hash hash; std::string pwhash,inpw; std::copy(curformdat->Value.begin(),curformdat->Value.end(), std::back_inserter(inpw)); hash.hash(inpw,pwhash); curec.Data->datasize=pwhash.length()+1; curec.Data->data=new char[curec.Data->datasize]; memcpy(curec.Data->data,pwhash.c_str(),pwhash.length()); curec.Data->data[pwhash.length()]='\0'; }else{ curec.Data->datasize=curformdat->Value.size()+1; curec.Data->data=new char[curec.Data->datasize]; memcpy(curec.Data->data,curformdat->Value.data(),curformdat->Value.size()); memcpy(curec.Data->data,curformdat->Value.data(), curformdat->Value.size()); curec.Data->data[curformdat->Value.size()]='\0'; } editrec.append(curec); delete[] curec.Data->data; } } Loading
src/hash.h +1 −0 Changes for src/hash.h: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ namespace authdb{ }; class Hash{ public: void hash(const std::string input,std::string &out); }; }