nickserv: email confirmation (CONFIRM) on registration
When email is configured and a REGISTER includes an address, the account starts unverified and a confirmation code is emailed. CONFIRM <code> verifies it (a federated AccountVerified event); INFO shows an unconfirmed email until then. Emailed codes now carry a purpose (reset vs confirm).
This commit is contained in:
parent
a2957ffe02
commit
fbcf0eaac7
6 changed files with 140 additions and 20 deletions
|
|
@ -1,4 +1,4 @@
|
|||
use crate::engine::db::Db;
|
||||
use crate::engine::db::{CodeKind, Db};
|
||||
use crate::engine::service::{Sender, ServiceCtx};
|
||||
|
||||
// RESETPASS <account>: email a reset code to the address on file.
|
||||
|
|
@ -18,7 +18,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
ctx.notice(me, from.uid, "That account has no email on file, so it can't be reset.");
|
||||
return;
|
||||
};
|
||||
let code = db.issue_reset_code(&canonical);
|
||||
let code = db.issue_code(&canonical, CodeKind::Reset);
|
||||
ctx.send_email(
|
||||
email,
|
||||
format!("Password reset for {canonical}"),
|
||||
|
|
@ -31,7 +31,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
|||
ctx.notice(me, from.uid, format!("\x02{name}\x02 isn't registered."));
|
||||
return;
|
||||
};
|
||||
if !db.take_reset_code(&canonical, code) {
|
||||
if !db.take_code(&canonical, CodeKind::Reset, code) {
|
||||
ctx.notice(me, from.uid, "Invalid or expired reset code.");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue