pass has been refactorized and nick command init
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/05/10 22:06:22 by aortigos #+# #+# */
|
||||
/* Updated: 2026/05/14 17:23:56 by aortigos ### ########.fr */
|
||||
/* Updated: 2026/05/14 20:21:31 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -17,17 +17,13 @@ void Server::pass_cmd(User &client, std::istringstream &ss)
|
||||
std::string args;
|
||||
|
||||
ss >> args;
|
||||
if (args.empty())
|
||||
return (client.send(":" SERVER_NAME " 461 * PASS :Not enough parameters\r\n"));
|
||||
if (client.isAuthenticated())
|
||||
{
|
||||
// Still need to find what server should reply to different errors
|
||||
client.send("You are already logged in\r\n");
|
||||
return ;
|
||||
}
|
||||
return (client.send(":" SERVER_NAME " 462 " + client.getNick() + " :Unauthorized command (already registered)\r\n"));
|
||||
if (this->password_ == args)
|
||||
client.setAuthenticated(true);
|
||||
else {
|
||||
// Still need to find what server should reply to different errors
|
||||
client.send("Invalid password\r\n");
|
||||
send(client.getFd(), res.c_str(), res.size(), 0);
|
||||
client.send(":" SERVER_NAME " 464 * :Password incorrect\r\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user