minor fixes qol #6

Merged
pratyush merged 1 commits from devel into master 2022-04-16 15:58:19 +02:00
3 changed files with 5 additions and 1 deletions
Showing only changes of commit a6a94d1602 - Show all commits

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)