Merge pull request #2006 from sehraf/pr_remove_rs_pw_as_token

remove retroshare password from json tokens
This commit is contained in:
G10h4ck 2020-06-09 16:19:11 +02:00 committed by GitHub
commit f456389580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);