mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
fixed interactions between webui and jsonapi in GUI
This commit is contained in:
parent
6878a7773d
commit
9491f1a78e
10 changed files with 94 additions and 27 deletions
|
@ -144,7 +144,7 @@ bool RsJsonAPI::parseToken(const std::string& clear_token,std::string& user,std:
|
|||
return false;
|
||||
|
||||
user = clear_token.substr(0,last_index);
|
||||
passwd = clear_token.substr(last_index+1,(int)clear_token.size()-(int)last_index-2);
|
||||
passwd = clear_token.substr(last_index+1,(int)clear_token.size()-(int)last_index-1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "util/rsthreads.h"
|
||||
#include "util/rsdebug.h"
|
||||
#include "retroshare/rswebui.h"
|
||||
#include "retroshare/rsjsonapi.h"
|
||||
|
||||
#define TEXT_HTML 0
|
||||
#define TEXT_CSS 1
|
||||
|
@ -139,3 +140,12 @@ int p3WebUI::status() const
|
|||
return WEBUI_STATUS_NOT_RUNNING;
|
||||
}
|
||||
|
||||
void p3WebUI::setUserPassword(const std::string& passwd)
|
||||
{
|
||||
#ifdef RS_JSONAPI
|
||||
if(!rsJsonAPI->authorizeUser("webui",passwd))
|
||||
std::cerr << "(EE) Cannot register webui token. Some error occurred when calling authorizeUser()" << std::endl;
|
||||
#else
|
||||
std::cerr << "(EE) JsonAPI is not available in this buildof Retroshare! Cannot register a user password for the WebUI" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
virtual bool stop() override { return RestbedService::stop();}
|
||||
virtual void setListeningPort(uint16_t port) override { RestbedService::setListeningPort(port) ;}
|
||||
virtual void setBindingAddress(const std::string& address) override { RestbedService::setBindAddress(address) ;}
|
||||
virtual void setUserPassword(const std::string& passwd) override;
|
||||
|
||||
virtual int status() const override;
|
||||
virtual std::vector<std::shared_ptr<restbed::Resource> > getResources() const override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue