From 981306668a27719d70a9ce1f1cf68fae3652f1cc Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Fri, 1 Apr 2022 18:22:17 +0200 Subject: [PATCH 1/3] Update link to the draft/account-registration spec --- README.md | 2 +- irc_register.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 92966f4..b2a4c12 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is a basic still WIP framework for registering an account on an ircd using ## Features -- It relies on the WIP IRCv3.2 spec [draft/account-registration](https://github.com/ProgVal/ircv3-specifications/blob/register/extensions/account-registration.md) +- It relies on the draft IRCv3 spec [draft/account-registration](https://ircv3.net/specs/extensions/account-registration.html) - It utilizes the flask framework and `WEBIRC` to relay remote host ip address. - Can be tweaked to allow registration attempts from exit-nodes and other unsavory hosts allowing them to securely work with the `require-sasl` constraint if needed. diff --git a/irc_register.py b/irc_register.py index 072d851..ce0379a 100644 --- a/irc_register.py +++ b/irc_register.py @@ -42,7 +42,7 @@ def ircregister(userip, username, password, email="*"): # but if the server responds with the corresponding FAIL we # need to try again. We can also handle email-required using # the same keys. How to access these key-value pairs? - # reference: https://github.com/ProgVal/ircv3-specifications/blob/register/extensions/account-registration.md#commands + # reference: https://ircv3.net/specs/extensions/account-registration.html # NICK and USER _send(irctokens.build("USER", ["u", "0", "*", username])) @@ -73,4 +73,4 @@ def ircregister(userip, username, password, email="*"): if line.command == "REGISTER" and ("SUCCESS" in line.params): to_send = irctokens.build("QUIT") _send(to_send) - return "SUCCESS" \ No newline at end of file + return "SUCCESS" From a6a94d16029963fc9ae9bd67c9fb4359a167e34a Mon Sep 17 00:00:00 2001 From: Pratyush Desai Date: Sat, 16 Apr 2022 19:18:20 +0530 Subject: [PATCH 2/3] 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) From 242acac3f1c8dd8bbbb49eef06dc452ee7384272 Mon Sep 17 00:00:00 2001 From: Pratyush Desai Date: Thu, 25 Aug 2022 19:03:28 +0200 Subject: [PATCH 3/3] Upload LICENSE --- LICENSE | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b55be0b --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2021-2022 Pratyush Desai and others + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of the author of this software nor the name of contributors to this software may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Portions of the included source code are copyright by its original author(s) and remain subject to its associated license.