1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 18:56:37 +02:00

Pass password to nick register event so modules like m_ldap_authentication can create the respective account using the decrypted password which might not always be available

This commit is contained in:
Adam
2014-05-01 18:38:17 -04:00
parent 8b2e8137f6
commit d79dd0b7d7
6 changed files with 9 additions and 8 deletions
+2 -1
View File
@@ -743,8 +743,9 @@ class CoreExport Module : public Extensible
/** Called when a nick is registered
* @param user The user registering the nick, of any
* @param The nick
* @param pass The password of the newly registered nick
*/
virtual void OnNickRegister(User *user, NickAlias *na) { throw NotImplementedException(); }
virtual void OnNickRegister(User *user, NickAlias *na, const Anope::string &pass) { throw NotImplementedException(); }
/** Called when a nick is suspended
* @param na The nick alias
+1 -1
View File
@@ -196,7 +196,7 @@ class NSAccess : public Module
{
}
void OnNickRegister(User *u, NickAlias *na) anope_override
void OnNickRegister(User *u, NickAlias *na, const Anope::string &) anope_override
{
if (u && Config->GetModule(this)->Get<bool>("addaccessonreg"))
na->nc->AddAccess(u->Mask());
+1 -1
View File
@@ -198,7 +198,7 @@ class CommandNSRegister : public Command
Log(LOG_COMMAND, source, this) << "to register " << na->nick << " (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")";
FOREACH_MOD(OnNickRegister, (source.GetUser(), na));
FOREACH_MOD(OnNickRegister, (source.GetUser(), na, pass));
if (na->nc->GetAccessCount())
source.Reply(_("Nickname \002%s\002 registered under your user@host-mask: %s"), u_nick.c_str(), na->nc->GetAccess(0).c_str());
+3 -3
View File
@@ -104,7 +104,7 @@ class IdentifyInterface : public LDAPInterface
{
na = new NickAlias(ii->req->GetAccount(), new NickCore(ii->req->GetAccount()));
na->last_realname = ii->user ? ii->user->realname : ii->req->GetAccount();
FOREACH_MOD(OnNickRegister, (ii->user, na));
FOREACH_MOD(OnNickRegister, (ii->user, na, ii->req->GetPassword()));
BotInfo *NickServ = Config->GetClient("NickServ");
if (ii->user && NickServ)
ii->user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
@@ -300,7 +300,7 @@ class NSIdentifyLDAP : public Module
}
}
void OnNickRegister(User *, NickAlias *na) anope_override
void OnNickRegister(User *, NickAlias *na, const Anope::string &pass) anope_override
{
if (!this->disable_register_reason.empty() || !this->ldap)
return;
@@ -326,7 +326,7 @@ class NSIdentifyLDAP : public Module
}
attributes[3].name = this->password_attribute;
attributes[3].values.push_back(na->nc->pass);
attributes[3].values.push_back(pass);
Anope::string new_dn = username_attribute + "=" + na->nick + "," + basedn;
this->ldap->Add(&this->orinterface, new_dn, attributes);
+1 -1
View File
@@ -42,7 +42,7 @@ class SQLAuthenticationResult : public SQL::Interface
if (na == NULL)
{
na = new NickAlias(req->GetAccount(), new NickCore(req->GetAccount()));
FOREACH_MOD(OnNickRegister, (user, na));
FOREACH_MOD(OnNickRegister, (user, na, ""));
if (user && NickServ)
user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->nick.c_str());
}
+1 -1
View File
@@ -638,7 +638,7 @@ class MChanstats : public Module
ci->Extend<bool>("CS_STATS");
}
void OnNickRegister(User *user, NickAlias *na)
void OnNickRegister(User *user, NickAlias *na, const Anope::string &)
{
if (NSDefChanstats)
na->nc->Extend<bool>("NS_STATS");