diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-12-05 05:44:02 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-12-05 05:44:02 +0000 |
commit | eadf52caf285914fcc9eb07358626fbcbb299eac (patch) | |
tree | 522d768485343fc2f5a62553fe9cf470bc21e278 | |
parent | 661755a1997137226a45d271b2c0409e30297097 (diff) |
Added ns_resetpass which can be used to reset user passwords by email, very useful if you're using encryption
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2685 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes.lang | 9 | ||||
-rw-r--r-- | data/example.conf | 7 | ||||
-rw-r--r-- | lang/cat.l | 43 | ||||
-rw-r--r-- | lang/de.l | 43 | ||||
-rw-r--r-- | lang/en_us.l | 41 | ||||
-rw-r--r-- | lang/es.l | 43 | ||||
-rw-r--r-- | lang/fr.l | 42 | ||||
-rw-r--r-- | lang/gr.l | 43 | ||||
-rw-r--r-- | lang/hun.l | 43 | ||||
-rw-r--r-- | lang/it.l | 43 | ||||
-rw-r--r-- | lang/nl.l | 43 | ||||
-rw-r--r-- | lang/pl.l | 49 | ||||
-rw-r--r-- | lang/pt.l | 41 | ||||
-rw-r--r-- | lang/ru.l | 40 | ||||
-rw-r--r-- | lang/tr.l | 40 | ||||
-rw-r--r-- | src/core/ns_register.c | 12 | ||||
-rw-r--r-- | src/core/ns_resetpass.c | 203 |
17 files changed, 723 insertions, 62 deletions
diff --git a/Changes.lang b/Changes.lang index 8dba08c5e..a6b8c0cb2 100644 --- a/Changes.lang +++ b/Changes.lang @@ -29,6 +29,14 @@ Anope Version 1.9.2 CHAN_INFO_OPT_PERSIST BOT_UNASSIGN_PERSISTANT_CHAN CHAN_HELP_SET_PERSIST + NICK_RESETPASS_SYNTAX + NICK_RESETPASS_SUBJECT + NICK_RESETPASS_MESSAGE + NICK_RESETPASS_COMPLETE + NICK_CONFIRM_EXPIRED + NICK_CONFIRM_SUCCESS + NICK_HELP_CMD_RESETPASS + NICK_HELP_RESETPASS *** Mod Strings: CHAN_HELP_SET @@ -36,6 +44,7 @@ Anope Version 1.9.2 CHAN_ACCESS_SYNTAX CHAN_HELP_ACCESS CHAN_HELP_SET + NICK_HELP_CONFIRM *** Del Strings: CHAN_PASSWORD_IS diff --git a/data/example.conf b/data/example.conf index 9f1aba99c..f4b0460ab 100644 --- a/data/example.conf +++ b/data/example.conf @@ -537,6 +537,7 @@ options * memoserv/sendall memoserv/staff * * nickserv/getpass nickserv/sendpass nickserv/getemail nickserv/suspend + * nickserv/resetpass * * operserv/global operserv/news operserv/stats operserv/kick * operserv/mode operserv/session operserv/modlist operserv/ignore @@ -646,8 +647,8 @@ mail sendfrom = "services@localhost.net" /* - * If set, SENDPASS will be restricted to IRC operators. This directive is - * optional. + * If set, SENDPASS and RESETPASS will be restricted to IRC operators. + * This directive is optional. * * WARNING: If you choose to not enable this option, you should limit the * number of processes that the services user can have at a time (you can @@ -711,7 +712,7 @@ nickserv * The core modules to load for NickServ. This is a space separated list that corresponds * to the base names of the modules for NickServ. This directive is optional, but highly recommended. */ - modules = "ns_help ns_register ns_group ns_identify ns_access ns_set ns_saset ns_drop ns_recover ns_release ns_sendpass ns_ghost ns_alist ns_info ns_list ns_logout ns_status ns_update ns_getpass ns_getemail ns_forbid ns_suspend" + modules = "ns_help ns_register ns_group ns_identify ns_access ns_set ns_saset ns_drop ns_recover ns_release ns_sendpass ns_ghost ns_alist ns_info ns_list ns_logout ns_status ns_update ns_getpass ns_getemail ns_forbid ns_suspend ns_resetpass" /* * Force users to give an e-mail address when they register a nick. This directive diff --git a/lang/cat.l b/lang/cat.l index 8cc0b6b8d..26a2209ca 100644 --- a/lang/cat.l +++ b/lang/cat.l @@ -873,6 +873,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK La clau de %s ha estat enviada. +# RESETPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID responses NICK_SUSPEND_SYNTAX SUSPEND nickname reason @@ -916,10 +934,6 @@ NICK_IS_PREREG This nick is awaiting an e-mail verification code before completing registration. NICK_ENTER_REG_CODE A passcode has been sent to %s, please type %R%s confirm <passcode> to complete registration -NICK_CONFIRM_NOT_FOUND - Registration step 1 may have expired, please use "%R%s register <password> <email>" first. -NICK_CONFIRM_INVALID - Invalid passcode has been entered, please check the e-mail again, and retry NICK_REG_MAIL_SUBJECT Nickname Registration (%s) NICK_REG_MAIL_HEAD @@ -939,6 +953,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nickname %s confirmed +# Confirm responces +NICK_CONFIRM_NOT_FOUND + Registration step 1 may have expired, please use "%R%s register <password> <email>" first. +NICK_CONFIRM_INVALID + Invalid passcode has been entered, please check the e-mail again, and retry. +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3395,6 +3419,8 @@ NICK_HELP_CMD_RELEASE RELEASE Repren possesió del teu nick després de RECOVER NICK_HELP_CMD_SENDPASS SENDPASS Vas oblidar la teva clau? Intenta això +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords. NICK_HELP_CMD_GHOST GHOST Disconnects a "ghost" IRC session using your nick NICK_HELP_CMD_ALIST @@ -3990,6 +4016,12 @@ NICK_HELP_SENDPASS Pot ser limitat a operadors d'IRC en certes xarxes. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -3999,6 +4031,9 @@ NICK_HELP_CONFIRM is sent to your e-mail address in the first step of the registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -892,6 +892,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Das Passwort von %s wurde per eMail verschickt. +# RESETPASS responces +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID responses NICK_SUSPEND_SYNTAX SUSPEND Nickname Grund @@ -929,10 +947,6 @@ NICK_IS_PREREG Dieser Nickname benötigt das Email Bestätigungs Passwort vor Abschluß der Registrierung. NICK_ENTER_REG_CODE Ein Password wurde zu %s gesendet, bitte tippe %R%s confirm <passcode> um die Registrierung abzuschließen. -NICK_CONFIRM_NOT_FOUND - Registrieungs Stufe 1 ist eventuell abgelaufen, bitte nutze zuerst "%R%s register <password> <email>". -NICK_CONFIRM_INVALID - Ein ungültiger Passcode wurde eingegeben, prüfe bitte deine Email und gib den Code erneut ein. NICK_REG_MAIL_SUBJECT Nickname Registrierung (%s) NICK_REG_MAIL_HEAD @@ -952,6 +966,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nickname %s bestätigt +# Confirm responses +NICK_CONFIRM_NOT_FOUND + Registrieungs Stufe 1 ist eventuell abgelaufen, bitte nutze zuerst "%R%s register <password> <email>". +NICK_CONFIRM_INVALID + Ein ungültiger Passcode wurde eingegeben, prüfe bitte deine Email und gib den Code erneut ein. +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3351,6 +3375,8 @@ NICK_HELP_CMD_RELEASE verwendung des RECOVER Befehls NICK_HELP_CMD_SENDPASS SENDPASS Passwort vergessen? Versuch das hier. +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords NICK_HELP_CMD_GHOST GHOST Trennt eine "ghost" IRC-Verbindung mit deinen Nicknamen NICK_HELP_CMD_ALIST @@ -4024,6 +4050,12 @@ NICK_HELP_SENDPASS Kann in manchen Netzen auf IRC Operatoren begrenzt sein. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -4034,6 +4066,9 @@ NICK_HELP_CONFIRM Registrationsprozesses. Für mehr Informationen über die erste Stufe des Registrationsprozesses tippe: %R%S HELP REGISTER + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. + NICK_HELP_CONFIRM_OPER Additionally, Services Operators with the nickserv/confirm permission can diff --git a/lang/en_us.l b/lang/en_us.l index 2ad73892e..deb0ec482 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -857,6 +857,23 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Password of %s has been sent. +# RESETPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # SUSPEND responses NICK_SUSPEND_SYNTAX SUSPEND nickname reason @@ -894,10 +911,6 @@ NICK_IS_PREREG This nick is awaiting an e-mail verification code before completing registration. NICK_ENTER_REG_CODE A passcode has been sent to %s, please type %R%s confirm <passcode> to complete registration -NICK_CONFIRM_NOT_FOUND - Registration step 1 may have expired, please use "%R%s register <password> <email>" first. -NICK_CONFIRM_INVALID - Invalid passcode has been entered, please check the e-mail again, and retry NICK_REG_MAIL_SUBJECT Nickname Registration (%s) NICK_REG_MAIL_HEAD @@ -917,6 +930,15 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nickname %s confirmed +# Confirm responses +NICK_CONFIRM_NOT_FOUND + Registration step 1 may have expired, please use "%R%s register <password> <email>" first. +NICK_CONFIRM_INVALID + Invalid passcode has been entered, please check the e-mail again, and retry +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. ########################################################################### @@ -3258,6 +3280,8 @@ NICK_HELP_CMD_RELEASE RELEASE Regain custody of your nick after RECOVER NICK_HELP_CMD_SENDPASS SENDPASS Forgot your password? Try this +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords NICK_HELP_CMD_GHOST GHOST Disconnects a "ghost" IRC session using your nick NICK_HELP_CMD_ALIST @@ -3855,6 +3879,12 @@ NICK_HELP_SENDPASS May be limited to IRC operators on certain networks. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -3864,6 +3894,9 @@ NICK_HELP_CONFIRM is sent to your e-mail address in the first step of the registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -877,6 +877,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK La clave de %s ha sido enviada. +# RESERTPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID responses NICK_SUSPEND_SYNTAX SUSPEND nickname reason @@ -914,10 +932,6 @@ NICK_IS_PREREG Este nick esta esperando una verificacion por e-mail antes de poder completar el registro. NICK_ENTER_REG_CODE El password ha sido enviado a %s, tipea %R%s confirm <password> para completar el registro. -NICK_CONFIRM_NOT_FOUND - El paso de registro 1 puede haber expirado. Usa "%R%s register <password> <email>" primero. -NICK_CONFIRM_INVALID - Password invalido. Chequea el e-mail e intenta nuevamente. NICK_REG_MAIL_SUBJECT Registro de Nick (%s) NICK_REG_MAIL_HEAD @@ -937,6 +951,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nick %s confirmado. +# Confirm responses +NICK_CONFIRM_NOT_FOUND + El paso de registro 1 puede haber expirado. Usa "%R%s register <password> <email>" primero. +NICK_CONFIRM_INVALID + Password invalido. Chequea el e-mail e intenta nuevamente. +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3367,6 +3391,8 @@ NICK_HELP_CMD_RELEASE RELEASE Retoma custodia de tu nick luego de RECOVER NICK_HELP_CMD_SENDPASS SENDPASS Olvidaste tu clave? Intenta esto +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords. NICK_HELP_CMD_GHOST GHOST Disconnects a "ghost" IRC session using your nick NICK_HELP_CMD_ALIST @@ -3962,6 +3988,12 @@ NICK_HELP_SENDPASS Puede ser limitado a operadores de IRC en ciertas redes. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Sintaxis: CONFIRM passcode @@ -3971,6 +4003,9 @@ NICK_HELP_CONFIRM enviado a tu direccion e-mail en el primer paso del proceso de registo. Para mas informacion sobre la primera etpa del proceso de registro, escribe: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -884,6 +884,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Le mot de passe de %s a été envoyé. +# RESETPASS responces +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID responses NICK_SUSPEND_SYNTAX SUSPEND pseudo raison @@ -927,10 +945,6 @@ NICK_IS_PREREG Une demande d'enregistrement pour ce pseudo est en cours. La confirmation n'a pas été effectuée. NICK_ENTER_REG_CODE Un passcode a été envoyé à %s, merci de taper %R%s confirm <passcode> une fois que vous l'aurez reçu pour compléter l'enregistrement. -NICK_CONFIRM_NOT_FOUND - Aucune validation en attente... Tapez: "%R%s register <password> <email>" pour l'enregistrer. -NICK_CONFIRM_INVALID - Passcode invalide, merci de le vérifier. NICK_REG_MAIL_SUBJECT Enregistrement d'un pseudo (%s) NICK_REG_MAIL_HEAD @@ -950,6 +964,15 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Pseudo %s confirmé +NICK_CONFIRM_NOT_FOUND + Aucune validation en attente... Tapez: "%R%s register <password> <email>" pour l'enregistrer. +NICK_CONFIRM_INVALID + Passcode invalide, merci de le vérifier. +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3420,6 +3443,8 @@ NICK_HELP_CMD_RELEASE après un RECOVER NICK_HELP_CMD_SENDPASS SENDPASS A utiliser en cas de perte de mot de passe +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords NICK_HELP_CMD_GHOST GHOST Deconnecte un "ghost irc" utilisant votre pseudo NICK_HELP_CMD_ALIST @@ -4021,6 +4046,12 @@ NICK_HELP_SENDPASS Peut être limité aux Opérateurs IRC sur certains réseaux. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -4031,6 +4062,9 @@ NICK_HELP_CONFIRM fournie à la première étape de votre enregistrement. Pour plus d'informations sur cette première étape, tapez: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -872,6 +872,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Ï êùäéêüò ôïõ %s Ý÷åé óôáëèåß. +# RESETPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the pasword for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID responses NICK_SUSPEND_SYNTAX SUSPEND nickname reason @@ -915,10 +933,6 @@ NICK_IS_PREREG This nick is awaiting an e-mail verification code before completing registration. NICK_ENTER_REG_CODE A passcode has been sent to %s, please type %R%s confirm <passcode> to complete registration -NICK_CONFIRM_NOT_FOUND - Registration step 1 may have expired, please use "%R%s register <password> <email>" first. -NICK_CONFIRM_INVALID - Invalid passcode has been entered, please check the e-mail again, and retry NICK_REG_MAIL_SUBJECT Nickname Registration (%s) NICK_REG_MAIL_HEAD @@ -938,6 +952,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nickname %s confirmed +# Confirm responses +NICK_CONFIRM_NOT_FOUND + Registration step 1 may have expired, please use "%R%s register <password> <email>" first. +NICK_CONFIRM_INVALID + Invalid passcode has been entered, please check the e-mail again, and retry. +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3387,6 +3411,8 @@ NICK_HELP_CMD_RELEASE RELEASE ÁíÜêôçóç ôçò êáôáêñÜôçóçò ôïõ øåõäùíýìïõ,ìåôÜ áðü RECOVER NICK_HELP_CMD_SENDPASS SENDPASS ÎÝ÷áóåò ôïí êùäéêü? Äïêßìáóå áõôü êáé èá óôï óôåßëïõìå åìåßò +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords. NICK_HELP_CMD_GHOST GHOST Disconnects a "ghost" IRC session using your nick NICK_HELP_CMD_ALIST @@ -3993,6 +4019,12 @@ NICK_HELP_SENDPASS Ìüíï ïé IRC operators óôá äßêôõá ðïõ åßíáé ìðïñïýí íá ôï êÜíïõí. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname which instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -4003,6 +4035,9 @@ NICK_HELP_CONFIRM registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. + NICK_HELP_CONFIRM_OPER Additionally, Services Operators with the nickserv/confirm permission can diff --git a/lang/hun.l b/lang/hun.l index 0b3131775..990cb39de 100644 --- a/lang/hun.l +++ b/lang/hun.l @@ -869,6 +869,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK %s nick jelszava elküldve. +# RESETPASS responces +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID válaszok NICK_SUSPEND_SYNTAX SUSPEND nickname reason @@ -906,10 +924,6 @@ NICK_IS_PREREG A nick az emailben elküldött kóddal való aktíválásra vár a regisztráció befejezéséhez. NICK_ENTER_REG_CODE A kód a %s címre lett küldve, írd be %R%s confirm <kód> a regisztráció befejezéséhez. -NICK_CONFIRM_NOT_FOUND - Regisztráció 1 lépése lehet, hogy elévült, írd be: "%R%s register <jelszó> <email>". -NICK_CONFIRM_INVALID - Érvénytelen kód, ellenõrizze az e-mailben, majd próbálja újra. NICK_REG_MAIL_SUBJECT Nicknév Regisztráció (%s) NICK_REG_MAIL_HEAD @@ -929,6 +943,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG A %s nicknév érvényesítve. +# CONFIRM responces +NICK_CONFIRM_NOT_FOUND + Regisztráció 1 lépése lehet, hogy elévült, írd be: "%R%s register <jelszó> <email>". +NICK_CONFIRM_INVALID + Érvénytelen kód, ellenõrizze az e-mailben, majd próbálja újra. +NICK_CONFIRM_EXPIRED + Your password request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################### # # ChanServ üzenetek @@ -3321,6 +3345,8 @@ NICK_HELP_CMD_RELEASE RELEASE Visszaadja a neved a RECOVER után NICK_HELP_CMD_SENDPASS SENDPASS Elfelejtetted a jelszavad? Próbáld ezt +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords. NICK_HELP_CMD_GHOST GHOST Disconnects a "ghost" IRC session using your nick NICK_HELP_CMD_ALIST @@ -3902,6 +3928,12 @@ NICK_HELP_SENDPASS Korlátozni lehet IRC operátorokra egyes hálózatokon. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcodE @@ -3911,6 +3943,9 @@ NICK_HELP_CONFIRM is sent to your e-mail address in the first step of the registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -859,6 +859,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK La password di %s è stata inviata. +# RESETPASS responces +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # SUSPEND responses NICK_SUSPEND_SYNTAX SUSPEND nick motivo @@ -896,10 +914,6 @@ NICK_IS_PREREG Questo nick è in attesa di un codice di attivazione via e-mail per completare la registrazione. NICK_ENTER_REG_CODE Un codice di attivazione è stato inviato a %s. Digita %R%s CONFIRM <codice> per completare la registrazione. -NICK_CONFIRM_NOT_FOUND - Il primo passo della registrazione potrebbe essere scaduto. Usa %R%s REGISTER <password> <e-mail>. -NICK_CONFIRM_INVALID - È stato inserito un codice di attivazione non valido. Controlla di nuovo la tua casella di posta e riprova. NICK_REG_MAIL_SUBJECT Registrazione del nick (%s) NICK_REG_MAIL_HEAD @@ -919,6 +933,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Il nick %s è stato confermato. +# CONFIRM responses +NICK_CONFIRM_NOT_FOUND + Il primo passo della registrazione potrebbe essere scaduto. Usa %R%s REGISTER <password> <e-mail>. +NICK_CONFIRM_INVALID + È stato inserito un codice di attivazione non valido. Controlla di nuovo la tua casella di posta e riprova. +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### @@ -3272,6 +3296,8 @@ NICK_HELP_CMD_RELEASE RELEASE Permette di usare di nuovo il proprio nick dopo un RECOVER NICK_HELP_CMD_SENDPASS SENDPASS Invia la password del proprio nick via e-mail +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords. NICK_HELP_CMD_GHOST GHOST Disconnette un nick fantasma che non è ancora caduto NICK_HELP_CMD_ALIST @@ -3869,6 +3895,12 @@ NICK_HELP_SENDPASS Potrebbe essere disponibile soltanto per gli IrcOp. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -3878,6 +3910,9 @@ NICK_HELP_CONFIRM is sent to your e-mail address in the first step of the registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -876,6 +876,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Wachtwoord %s is verstuurd. +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL + + %s administrators. + +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID responses NICK_SUSPEND_SYNTAX SUSPEND nick reden @@ -913,10 +931,6 @@ NICK_IS_PREREG Deze nick wacht nog op een e-mail verificatie code coor de registratie is voltooid. NICK_ENTER_REG_CODE Een verificatiecode is verstuurd naar %s. Type %R%s confirm <verificatiecode> om de registratie te voltooien. -NICK_CONFIRM_NOT_FOUND - Registratie stap 1 kan verlopen zijn. Gebruik eerst "%R%s register <wachtwoord> <email>". -NICK_CONFIRM_INVALID - Ongeldige verificatiecode ingevuld. Controleer je e-mail nog eens en probeer opnieuw. NICK_REG_MAIL_SUBJECT Nickname Registratie (%s) NICK_REG_MAIL_HEAD @@ -936,6 +950,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nickname %s geverificeerd. +# CONFIRM responces +NICK_CONFIRM_NOT_FOUND + Registratie stap 1 kan verlopen zijn. Gebruik eerst "%R%s register <wachtwoord> <email>". +NICK_CONFIRM_INVALID + Ongeldige verificatiecode ingevuld. Controleer je e-mail nog eens en probeer opnieuw. +NICK_CONFIRM_EXPIRED + Your password request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3348,6 +3372,8 @@ NICK_HELP_CMD_RELEASE RELEASE Je nick terugnemen nadat je RECOVER gebruikt hebt NICK_HELP_CMD_SENDPASS SENDPASS Je wachtwoord vergeten? Probeer dit +NICK_HELP_CMD_RESETPASS + RESETPASS Helps you reset lost passwords. NICK_HELP_CMD_GHOST GHOST Disconnects a "ghost" IRC session using your nick NICK_HELP_CMD_ALIST @@ -3935,6 +3961,12 @@ NICK_HELP_SENDPASS Kan gelimiteerd zijn tot IRC operators op sommige netwerken. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -3944,6 +3976,9 @@ NICK_HELP_CONFIRM is sent to your e-mail address in the first step of the registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password NICK_HELP_CONFIRM_OPER @@ -1108,6 +1108,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Has³o do nicka %s zosta³o wys³ane. +# RESETPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # SUSPEND responses NICK_SUSPEND_SYNTAX SUSPEND nick powód @@ -1158,14 +1176,6 @@ NICK_ENTER_REG_CODE Kod zosta³ wys³any na adres %s. Napisz %R%s CONFIRM <kod>, aby dokoñczyæ procedurê rejestracji. -NICK_CONFIRM_NOT_FOUND - Termin wa¿no¶ci kodu rejestracyjnego up³yn±³. - Napisz: %R%s REGISTER <has³o> <email>, - aby znowu zacz±æ rejestracje. - -NICK_CONFIRM_INVALID - Podano nieprawid³owy kod, sprawd¼ wiadomo¶æ e-mail i spróbowaæ ponownie. - NICK_REG_MAIL_SUBJECT Rejestracja nicka %s @@ -1192,6 +1202,20 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nick %s potwierdzony. +NICK_CONFIRM_NOT_FOUND + Termin wa¿no¶ci kodu rejestracyjnego up³yn±³. + Napisz: %R%s REGISTER <has³o> <email>, + aby znowu zacz±æ rejestracje. + +NICK_CONFIRM_INVALID + Podano nieprawid³owy kod, sprawd¼ wiadomo¶æ e-mail i spróbowaæ ponownie. + +NICK_CONFIRM_EXPIRED + Your password reset request has expired. + +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -4935,6 +4959,12 @@ NICK_HELP_SENDPASS Ta komenda w niektórych sieciach mo¿e byæ dostêpna jedynie dla osób z uprawnieniami IRC operatora. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with the instructions on how to + reset their password. + NICK_HELP_CONFIRM Sk³adnia: CONFIRM kod @@ -4944,6 +4974,9 @@ NICK_HELP_CONFIRM adres e-mail podany podczas pierwszego kroku rejestracji. Aby siê dowiedzieæ wiêcej wpisz %R%S HELP REGISTER + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. + NICK_HELP_CONFIRM_OPER Additionally, Services Operators with the nickserv/confirm permission can @@ -878,6 +878,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Senha para %s foi enviada. +# RESETPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # SUSPEND responses NICK_SUSPEND_SYNTAX SUSPEND nick motivo @@ -915,10 +933,6 @@ NICK_IS_PREREG Esse nick está aguardando um código de verificação por e-mail antes de completar o registro. NICK_ENTER_REG_CODE O passcode foi enviado para %s, por favor digite %R%s confirm <passcode> para completar o registro. -NICK_CONFIRM_NOT_FOUND - O primeiro passo do registro deve ter expirado, por favor use %R%s register <senha> <email> primeiro. -NICK_CONFIRM_INVALID - Um passcode inválido foi digitado, por favor verifique o e-mail e tente novamente NICK_REG_MAIL_SUBJECT Registro de nick (%s) NICK_REG_MAIL_HEAD @@ -938,6 +952,16 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nick %s confirmado +# CONFIRM responses +NICK_CONFIRM_NOT_FOUND + O primeiro passo do registro deve ter expirado, por favor use %R%s register <senha> <email> primeiro. +NICK_CONFIRM_INVALID + Um passcode inválido foi digitado, por favor verifique o e-mail e tente novamente +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick + ########################################################################### # # ChanServ messages @@ -3882,6 +3906,12 @@ NICK_HELP_SENDPASS Poder ser limitado a Operadores de IRC em algumas redes. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a codekey to the nickname with the instructions on how to + reset their psasword. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -3891,6 +3921,9 @@ NICK_HELP_CONFIRM is sent to your e-mail address in the first step of the registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -860,6 +860,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK Ïàðîëü äëÿ íèêà %s áûë âûñëàí íà åãî email-àäðåñ. +# RESETPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # SUSPEND responses NICK_SUSPEND_SYNTAX SUSPEND íèê ïðè÷èíà @@ -897,10 +915,6 @@ NICK_IS_PREREG Ýòîò íèê îæèäàåò ïîäòâåðæäåíèÿ ÷åðåç e-mail ïåðåä çàâåðøåíèåì ðåãèñòðàöèè. NICK_ENTER_REG_CODE Auth-êîä áûë âûñëàí íà %s, äëÿ çàâåðøåíèÿ ðåãèñòðàöèè èñïîëüçóéòå êîìàíäó %R%s confirm auth-êîä -NICK_CONFIRM_NOT_FOUND - Âðåìÿ ïåðâîé ÷àñòè ðåãèñòðàöèè èñòåêëî, âîñïîëüçóéòåñü êîìàíäîé "%R%s register <ïàðîëü> <email>" -NICK_CONFIRM_INVALID - Áûë ââåäåí íåâåðíûé auth-êîä, ïîæàëóéñòà, ïðîâåðüòå âàø e-mail ñíîâà è ïîïðîáóéòå åùå ðàç. NICK_REG_MAIL_SUBJECT Ðåãèñòðàöèÿ íèêà %s NICK_REG_MAIL_HEAD @@ -920,6 +934,15 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Ðåãèñòðàöèÿ íèêà %s ïîäòâåðæäåíà. +NICK_CONFIRM_NOT_FOUND + Âðåìÿ ïåðâîé ÷àñòè ðåãèñòðàöèè èñòåêëî, âîñïîëüçóéòåñü êîìàíäîé "%R%s register <ïàðîëü> <email>" +NICK_CONFIRM_INVALID + Áûë ââåäåí íåâåðíûé auth-êîä, ïîæàëóéñòà, ïðîâåðüòå âàø e-mail ñíîâà è ïîïðîáóéòå åùå ðàç. +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3931,6 +3954,12 @@ NICK_HELP_SENDPASS Ïðèìå÷àíèå: SENDPASS ìîæåò áûòü îãðàíè÷åí äëÿ èñïîëüçîâàíèÿ òîëüêî IRC-îïåðàòîðàìè äàííîé ñåòè. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with the instructions on how to + reset their password. + NICK_HELP_CONFIRM Ñèíòàêñèñ: CONFIRM auth-êîä @@ -3940,6 +3969,9 @@ NICK_HELP_CONFIRM Êîäîâàÿ ôðàçà, êîòîðàÿ óêàçûâàåòñÿ â êà÷åñòâå ïàðàìåòðà, âûñûëàåòñÿ íà âàø e-mail â ïåðâîé ÷àñòè ïðîöåññà ðåãèñòðàöèè íèêà. Äëÿ áîëåå ïîäðîáíîé èíôîðìàöèè ñì. %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER @@ -879,6 +879,24 @@ NICK_SENDPASS_LINE_5 NICK_SENDPASS_OK %s nickinin þifresi gönderildi. +# RESETPASS responses +NICK_RESETPASS_SYNTAX + RESETPASS nickname +NICK_RESETPASS_SUBJECT + Reset password request for %s +NICK_RESETPASS_MESSAGE + Hi, + + You have requested to have the password for %s reset. + To reset your password, type %R%s CONFIRM %s + If you don't know why this mail is sent to you, please ignore it silently. + + PLEASE DON'T ANSWER TO THIS MAIL! + + %s administrators. +NICK_RESETPASS_COMPLETE + Password reset email for %s has been sent. + # FORBID responses NICK_SUSPEND_SYNTAX SUSPEND nickname reason @@ -922,10 +940,6 @@ NICK_IS_PREREG This nick is awaiting an e-mail verification code before completing registration. NICK_ENTER_REG_CODE A passcode has been sent to %s, please type %R%s confirm <passcode> to complete registration -NICK_CONFIRM_NOT_FOUND - Registration step 1 may have expired, please use "%R%s register <password> <email>" first. -NICK_CONFIRM_INVALID - Invalid passcode has been entered, please check the e-mail again, and retry NICK_REG_MAIL_SUBJECT Nickname Registration (%s) NICK_REG_MAIL_HEAD @@ -945,6 +959,15 @@ NICK_GETPASS_PASSCODE_IS NICK_FORCE_REG Nickname %s confirmed +NICK_CONFIRM_NOT_FOUND + Registration step 1 may have expired, please use "%R%s register <password> <email>" first. +NICK_CONFIRM_INVALID + Invalid passcode has been entered, please check the e-mail again, and retry +NICK_CONFIRM_EXPIRED + Your password reset request has expired. +NICK_CONFIRM_SUCCESS + You are now identified for your nick. Change your password using "%R%s SET PASSWORD newpassword" now. + ########################################################################### # # ChanServ messages @@ -3982,6 +4005,12 @@ NICK_HELP_SENDPASS Bazý networklerde sadece IRC operatörleri kullanabilir. +NICK_HELP_RESETPASS + Syntax: RESETPASS nickname + + Sends a code key to the nickname with instructions on how to + reset their password. + NICK_HELP_CONFIRM Syntax: CONFIRM passcode @@ -3991,6 +4020,9 @@ NICK_HELP_CONFIRM is sent to your e-mail address in the first step of the registration process. For more information about the first stage of the registration process, type: %R%S HELP REGISTER + + This is also used after the RESETPASS command has been used to + force identify you to your nick so you may change your password. NICK_HELP_CONFIRM_OPER diff --git a/src/core/ns_register.c b/src/core/ns_register.c index a569011f6..6b8eb9457 100644 --- a/src/core/ns_register.c +++ b/src/core/ns_register.c @@ -97,7 +97,7 @@ class CommandNSConfirm : public Command CommandReturn DoConfirm(User *u, const std::vector<ci::string> ¶ms) { NickRequest *nr = NULL; - const char *passcode = params.size() ? params[0].c_str() : NULL; + const char *passcode = !params.empty() ? params[0].c_str() : NULL; nr = findrequestnick(u->nick); @@ -105,7 +105,7 @@ class CommandNSConfirm : public Command { if (!passcode) { - notice_lang(Config.s_NickServ, u, NICK_CONFIRM_INVALID); + this->OnSyntaxError(u, ""); return MOD_CONT; } @@ -143,6 +143,7 @@ class CommandNSConfirm : public Command ActuallyConfirmNick(u, nr, false); return MOD_CONT; } + public: CommandNSConfirm(const std::string &cmdn, int min, int max) : Command(cmdn, min, max) { @@ -161,6 +162,11 @@ class CommandNSConfirm : public Command notice_help(Config.s_NickServ, u, NICK_HELP_CONFIRM_OPER); return true; } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + notice_lang(Config.s_NickServ, u, NICK_CONFIRM_INVALID); + } }; class CommandNSRegister : public CommandNSConfirm @@ -366,7 +372,7 @@ class NSRegister : public Module this->SetType(CORE); this->AddCommand(NICKSERV, new CommandNSRegister()); - this->AddCommand(NICKSERV, new CommandNSConfirm("CONFIRM", 0, 1)); + this->AddCommand(NICKSERV, new CommandNSConfirm("CONFIRM", 1, 1)); this->AddCommand(NICKSERV, new CommandNSResend()); ModuleManager::Attach(I_OnNickServHelp, this); diff --git a/src/core/ns_resetpass.c b/src/core/ns_resetpass.c new file mode 100644 index 000000000..81bbc2655 --- /dev/null +++ b/src/core/ns_resetpass.c @@ -0,0 +1,203 @@ +/* NickServ core functions + * + * (C) 2003-2009 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSResetPass : public Command +{ + public: + CommandNSResetPass() : Command("RESETPASS", 1, 1) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickAlias *na; + + if (Config.RestrictMail && !u->nc->HasCommand("nickserv/resetpass")) + notice_lang(Config.s_NickServ, u, ACCESS_DENIED); + if (!(na = findnick(params[0].c_str()))) + notice_lang(Config.s_NickServ, u, NICK_X_NOT_REGISTERED, params[0].c_str()); + else if (na->HasFlag(NS_FORBIDDEN)) + notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); + else + { + char buf[BUFSIZE], message[BUFSIZE]; + snprintf(buf, sizeof(buf), getstring(na, NICK_RESETPASS_SUBJECT), na->nick); + + MailInfo *mail = MailBegin(u, na->nc, buf, Config.s_NickServ); + if (!mail) + return MOD_CONT; + + char passcode[20]; + int min = 1, max = 62; + int chars[] = { + ' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', + 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', + 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', + 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' + }; + + int idx; + for (idx = 0; idx < 20; ++idx) + passcode[idx] = chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min]; + passcode[idx] = '\0'; + + snprintf(message, sizeof(message), getstring(na, NICK_RESETPASS_MESSAGE), na->nick, Config.s_NickServ, passcode, Config.NetworkName); + fprintf(mail->pipe, "%s", message); + fprintf(mail->pipe, "\n.\n"); + MailEnd(mail); + + char *c; + time_t *t; + if (na->nc->GetExt("ns_resetpass_code", c)) + { + delete [] c; + na->nc->Shrink("ns_resetpass_code"); + } + if (na->nc->GetExt("ns_resetpass_time", t)) + { + delete t; + na->nc->Shrink("ns_resetpass_time"); + } + + na->nc->Extend("ns_resetpass_code", sstrdup(passcode)); + t = new time_t(time(NULL)); + na->nc->Extend("ns_resetpass_time", t); + + alog("%s: %s!%s@%s used RESETPASS on %s (%s)", Config.s_NickServ, u->nick, u->GetIdent().c_str(), u->host, na->nick, na->nc->display); + notice_lang(Config.s_NickServ, u, NICK_RESETPASS_COMPLETE, na->nick); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + notice_help(Config.s_NickServ, u, NICK_HELP_RESETPASS); + return true; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + syntax_error(Config.s_NickServ, u, "RESETPASS", NICK_RESETPASS_SYNTAX); + } +}; + +class NSResetPass : public Module +{ + public: + NSResetPass(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + if (!Config.UseMail) + throw ModuleException("Not using mail."); + + this->AddCommand(NICKSERV, new CommandNSResetPass()); + + Implementation i[] = { I_OnNickServHelp, I_OnDelCore, I_OnPreCommand }; + ModuleManager::Attach(i, this, 3); + } + + void OnNickServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_RESETPASS); + } + + void OnDelCore(NickCore *nc) + { + char *c; + time_t *t; + + if (nc->GetExt("ns_resetpass_code", c)) + { + delete [] c; + nc->Shrink("ns_resetpass_code"); + } + if (nc->GetExt("ns_resetpass_time", t)) + { + delete t; + nc->Shrink("ns_resetpass_time"); + } + } + + EventReturn OnPreCommand(User *u, const std::string &service, const ci::string &command, const std::vector<ci::string> ¶ms) + { + if (service == Config.s_NickServ && command == "CONFIRM" && !params.empty()) + { + NickAlias *na = findnick(u->nick); + char *c; + time_t *t; + + if (na && na->nc->GetExt("ns_resetpass_code", c) && na->nc->GetExt("ns_resetpass_time", t)) + { + if (*t < time(NULL) - 3600) + { + delete [] c; + delete t; + na->nc->Shrink("ns_resetpass_code"); + na->nc->Shrink("ns_resetpass_time"); + notice_lang(Config.s_NickServ, u, NICK_CONFIRM_EXPIRED); + return EVENT_STOP; + } + + std::string passcode = params[0].c_str(); + if (passcode == c) + { + delete [] c; + delete t; + na->nc->Shrink("ns_resetpass_code"); + na->nc->Shrink("ns_resetpass_time"); + + u->UpdateHost(); + if (na->last_realname) + delete [] na->last_realname; + na->last_realname = sstrdup(u->realname); + na->last_seen = time(NULL); + u->nc = na->nc; + ircdproto->SendAccountLogin(u, u->nc); + ircdproto->SetAutoIdentificationToken(u); + FOREACH_MOD(I_OnNickIdentify, OnNickIdentify(u)); + + alog("%s: %s!%s@%s used CONFIRM with RESETPASS to forcefully identify to %s", Config.s_NickServ, u->nick, u->GetIdent().c_str(), u->host, na->nick); + + notice_lang(Config.s_NickServ, u, NICK_CONFIRM_SUCCESS, Config.s_NickServ); + + if (ircd->vhost) + do_on_id(u); + if (Config.NSModeOnID) + do_setmodes(u); + check_memos(u); + } + else + { + alog("%s: Invalid CONFIRM passcode for %s from %s!%s@%s", Config.s_NickServ, na->nick, u->nick, u->GetIdent().c_str(), u->host); + notice_lang(Config.s_NickServ, u, NICK_CONFIRM_INVALID); + bad_password(u); + } + + return EVENT_STOP; + } + } + + return EVENT_CONTINUE; + } +}; + +MODULE_INIT(NSResetPass) |