33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* pass.cpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2026/04/17 11:53:56 by aortigos #+# #+# */
|
|
/* Updated: 2026/04/17 11:56:21 by aortigos ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "../Server/Server.hpp"
|
|
|
|
void Server::cmd_pass(int fd, std::istringstream &ss)
|
|
{
|
|
std::string args;
|
|
|
|
ss >> args;
|
|
|
|
if (args == this->password)
|
|
{
|
|
clients[fd].setAuthenticated(true);
|
|
|
|
std::string msg = "You have been authenticated!\r\n";
|
|
send(fd, msg.c_str(), msg.size(), 0);
|
|
}
|
|
else
|
|
{
|
|
send(fd, ERR_PASSWORD.c_str(), ERR_PASSWORD.size(), 0);
|
|
removeClient(fd);
|
|
}
|
|
} |