Changeset - 9391c487b518
[Not reviewed]
0 3 0
Jan Kaluza - 9 years ago 2016-02-19 09:16:08
jkaluza@redhat.com
Web interface: Allow registering with no password
3 files changed with 11 insertions and 4 deletions:
0 comments (0 inline, 0 general)
libtransport/AdminInterface.cpp
Show inline comments
 
@@ -265,17 +265,22 @@ void AdminInterface::handleQuery(Swift::Message::ref message) {
 
		message->setBody(boost::lexical_cast<std::string>(msgCount));
 
	}
 
	else if (msg.find("register ") == 0 && m_userRegistration) {
 
		std::string body = msg;
 
		std::vector<std::string> args;
 
		boost::split(args, body, boost::is_any_of(" "));
 
		if (args.size() == 4) {
 
		if (args.size() == 4 || args.size() == 3) {
 
			UserInfo res;
 
			res.jid = args[1];
 
			res.uin = args[2];
 
			res.password = args[3];
 
			if (args.size() == 3) {
 
				res.password = args[3];
 
			}
 
			else {
 
				res.password = args[4];
 
			}
 
			res.language = "en";
 
			res.encoding = "utf-8";
 
			res.vip = 0;
 

	
 
			if (m_userRegistration->registerUser(res)) {
 
				message->setBody("User registered.");
spectrum/src/frontends/slack/SlackUserRegistration.cpp
Show inline comments
 
@@ -144,15 +144,17 @@ std::string SlackUserRegistration::handleOAuth2Code(const std::string &code, con
 
		return "The token you have provided is invalid";
 
	}
 

	
 
	std::string slackChannel;
 
	std::string uin;
 
	std::string password;
 
	if (data.size() == 4) {
 
	if (data.size() >= 3) {
 
		slackChannel = data[1];
 
		uin = data[2];
 
	}
 
	if (data.size() == 4) {
 
		password = data[3];
 
	}
 

	
 
	UserInfo user;
 
	user.uin = "";
 
	user.password = "";
spectrum_manager/src/APIServer.cpp
Show inline comments
 
@@ -253,13 +253,13 @@ void APIServer::serve_instances_register(Server *server, Server::session *sessio
 
	m_storage->getUserSetting(info.id, instance, type, username);
 

	
 
	std::string jid = get_http_var(hm, "jid");
 
	std::string uin = get_http_var(hm, "uin");
 
	std::string password = get_http_var(hm, "password");
 

	
 
	if (jid.empty() || uin.empty() || password.empty()) {
 
	if (jid.empty() || uin.empty()) {
 
		send_ack(conn, true, "Insufficient data.");
 
	}
 
	else {
 
		// Check if the frontend wants to use OAuth2 (Slack for example).
 
		std::string response = server->send_command(instance, "get_oauth2_url " + jid + " " + uin + " " + password);
 
		if (!response.empty()) {
0 comments (0 inline, 0 general)