remove password from json tokens

This commit is contained in:
sehraf 2020-06-05 22:05:38 +02:00
parent c1c303218c
commit 878111d224
No known key found for this signature in database
GPG Key ID: DF09F6EAE356B2C6

View File

@ -180,6 +180,7 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"),
std::string errorMessage;
bool makeHidden = false;
bool makeAutoTor = false;
std::string createToken;
// deserialize input parameters from JSON
{
@ -189,6 +190,7 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"),
RS_SERIAL_PROCESS(password);
RS_SERIAL_PROCESS(makeHidden);
RS_SERIAL_PROCESS(makeAutoTor);
RS_SERIAL_PROCESS(createToken);
}
// call retroshare C++ API
@ -196,8 +198,9 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"),
location, password, errorMessage, makeHidden,
makeAutoTor );
if(retval)
authorizeUser(location.mLocationId.toStdString(),password);
std::string tokenUser, tokenPw;
if(retval && parseToken(createToken, tokenUser, tokenPw))
authorizeUser(tokenUser,tokenPw);
// serialize out parameters and return value to JSON
{
@ -238,9 +241,6 @@ JsonApiServer::JsonApiServer(): configMutex("JsonApiServer config"),
RsInit::LoadCertificateStatus retval =
rsLoginHelper->attemptLogin(account, password);
if( retval == RsInit::OK )
authorizeUser(account.toStdString(), password);
// serialize out parameters and return value to JSON
{
RsGenericSerializer::SerializeContext& ctx(cAns);