protocol auth fixed
This commit is contained in:
parent
4947a95899
commit
810260b05a
6 changed files with 60 additions and 31 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/12 17:52:12 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/16 18:30:15 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,9 +21,8 @@ e_code cmd::Nick::checkArgs() {
|
|||
return ERR_NONICKNAMEGIVEN;
|
||||
}
|
||||
User* existing = searchList<User*>(_users, _args[1]); // à adapter si besoin
|
||||
if (existing != NULL) {
|
||||
|
||||
WARNING_MSG("Nick already in use: " << _args[1]);
|
||||
if (existing != NULL) {
|
||||
_sender->appendToWriteBuffer(":" + _sender->getPrefix() + " 433 * " + _args[1] + " :Nickname is already in use\r\n");
|
||||
return ERR_NICKNAMEINUSE;
|
||||
}
|
||||
return _PARSING_OK;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/12 17:52:35 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/16 17:33:20 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -29,17 +29,22 @@ e_code Pass::checkArgs() {
|
|||
* @note To connect a user with the password
|
||||
*/
|
||||
|
||||
void Pass::execute() {
|
||||
if (checkArgs() != _PARSING_OK) {
|
||||
ERROR_MSG("Invalid arguments for Pass command (see warning message)");
|
||||
DEBUG_MSG("skill issues");
|
||||
return;
|
||||
}
|
||||
DEBUG_MSG("mais pas trop skill issues");
|
||||
if (_args.at(1) != _server->getPassword()) {
|
||||
ERROR_MSG("The password is incorrect");
|
||||
void cmd::Pass::execute() {
|
||||
if (_args.size() < 2) {
|
||||
_sender->appendToWriteBuffer(":localhost 461 PASS :Not enough parameters\r\n");
|
||||
return;
|
||||
}
|
||||
_sender->setHasPass(true);
|
||||
_sender->setPassReceived(true);
|
||||
if (_args[1] == _server->getPassword())
|
||||
{
|
||||
DEBUG_MSG("PASSISVALID");
|
||||
_sender->setPassIsValid(true);
|
||||
}
|
||||
else{
|
||||
DEBUG_MSG("PASSISINVALID");
|
||||
_sender->setPassIsValid(false);
|
||||
}
|
||||
|
||||
_sender->checkRegistration();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue