minor fixes qol

This commit is contained in:
Pratyush Desai 2022-04-16 19:18:20 +05:30
parent 1499693b04
commit a6a94d1602
Signed by: pratyush
GPG Key ID: DBA5BB7505946FAD
3 changed files with 5 additions and 1 deletions

View File

@ -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:

View File

@ -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')])

View File

@ -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)