Parser accept server functions, and first stage for implementing client.send function
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/10 22:45:31 by aortigos ### ########.fr */
|
||||
/* Updated: 2026/05/14 17:23:56 by aortigos ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -20,15 +20,14 @@ void Server::pass_cmd(User &client, std::istringstream &ss)
|
||||
if (client.isAuthenticated())
|
||||
{
|
||||
// Still need to find what server should reply to different errors
|
||||
std::string res = "You are already authenticated";
|
||||
send(client.getFd(), res.c_str(), res.size(), 0);
|
||||
client.send("You are already logged in\r\n");
|
||||
return ;
|
||||
}
|
||||
if (this->password_ == args)
|
||||
client->authenticated = true;
|
||||
client.setAuthenticated(true);
|
||||
else {
|
||||
// Still need to find what server should reply to different errors
|
||||
std::string res = "Invalid password";
|
||||
client.send("Invalid password\r\n");
|
||||
send(client.getFd(), res.c_str(), res.size(), 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user