From a6a94d16029963fc9ae9bd67c9fb4359a167e34a Mon Sep 17 00:00:00 2001 From: Pratyush Desai Date: Sat, 16 Apr 2022 19:18:20 +0530 Subject: [PATCH] minor fixes qol --- flaskapp.py | 3 +++ forms.py | 1 + irc_register.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flaskapp.py b/flaskapp.py index a886164..4369970 100644 --- a/flaskapp.py +++ b/flaskapp.py @@ -33,6 +33,9 @@ def register(): flash("Illegal Character in Username. Please choose a different one one.") elif response == "ERR_NICKNAMEINUSE": flash("Username already taken. Please choose a different one!") + elif response == "CAP_REFUSED": + flash("This IRCd doesn't support the draft/account-registration capability") + return redirect(webchat_url) elif response == "SUCCESS": return redirect(webchat_url) else: diff --git a/forms.py b/forms.py index ea052af..e571f3c 100644 --- a/forms.py +++ b/forms.py @@ -4,6 +4,7 @@ from wtforms.validators import DataRequired, Length, EqualTo class RegistrationForm(FlaskForm): + # clarify that it conforms with casemapping on ircd. username = StringField('Username', validators=[DataRequired(), Length(min=1, max=32)]) password = PasswordField('Password', validators=[DataRequired()]) confirm_password = PasswordField('Confirm Password', validators=[DataRequired(), EqualTo('password')]) diff --git a/irc_register.py b/irc_register.py index 072d851..d453b69 100644 --- a/irc_register.py +++ b/irc_register.py @@ -59,7 +59,7 @@ def ircregister(userip, username, password, email="*"): return "ERR_NICKNAMEINUSE" _send(irctokens.build("CAP", ["REQ", "draft/account-registration"])) if line.command == "CAP" and ("NAK" in line.params): - return "cap refused" + return "CAP_REFUSED" elif line.command == "CAP" and ("ACK" in line.params): to_send = irctokens.build("CAP", ["END"]) _send(to_send) -- 2.35.3