mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(fastapi): no longer care about ResetKey collisions
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
b0b5e4c9d1
commit
aa717a4ef9
2 changed files with 6 additions and 6 deletions
|
@ -15,7 +15,7 @@ import aurweb.config
|
||||||
import aurweb.models.account_type
|
import aurweb.models.account_type
|
||||||
import aurweb.schema
|
import aurweb.schema
|
||||||
|
|
||||||
from aurweb import db, logging, schema
|
from aurweb import db, logging, schema, util
|
||||||
from aurweb.models.account_type import AccountType as _AccountType
|
from aurweb.models.account_type import AccountType as _AccountType
|
||||||
from aurweb.models.ban import is_banned
|
from aurweb.models.ban import is_banned
|
||||||
from aurweb.models.declarative import Base
|
from aurweb.models.declarative import Base
|
||||||
|
@ -249,5 +249,5 @@ class User(Base):
|
||||||
self.ID, str(self.AccountType), self.Username)
|
self.ID, str(self.AccountType), self.Username)
|
||||||
|
|
||||||
|
|
||||||
def generate_unique_resetkey():
|
def generate_resetkey():
|
||||||
return db.make_random_value(User, User.ResetKey, 32)
|
return util.make_random_string(32)
|
||||||
|
|
|
@ -16,7 +16,7 @@ from aurweb.exceptions import ValidationError
|
||||||
from aurweb.l10n import get_translator_for_request
|
from aurweb.l10n import get_translator_for_request
|
||||||
from aurweb.models import account_type as at
|
from aurweb.models import account_type as at
|
||||||
from aurweb.models.ssh_pub_key import get_fingerprint
|
from aurweb.models.ssh_pub_key import get_fingerprint
|
||||||
from aurweb.models.user import generate_unique_resetkey
|
from aurweb.models.user import generate_resetkey
|
||||||
from aurweb.scripts.notify import ResetKeyNotification, WelcomeNotification
|
from aurweb.scripts.notify import ResetKeyNotification, WelcomeNotification
|
||||||
from aurweb.templates import make_context, make_variable_context, render_template
|
from aurweb.templates import make_context, make_variable_context, render_template
|
||||||
from aurweb.users import update, validate
|
from aurweb.users import update, validate
|
||||||
|
@ -93,7 +93,7 @@ async def passreset_post(request: Request,
|
||||||
status_code=HTTPStatus.SEE_OTHER)
|
status_code=HTTPStatus.SEE_OTHER)
|
||||||
|
|
||||||
# If we got here, we continue with issuing a resetkey for the user.
|
# If we got here, we continue with issuing a resetkey for the user.
|
||||||
resetkey = generate_unique_resetkey()
|
resetkey = generate_resetkey()
|
||||||
with db.begin():
|
with db.begin():
|
||||||
user.ResetKey = resetkey
|
user.ResetKey = resetkey
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ async def account_register_post(request: Request,
|
||||||
|
|
||||||
# Create a user with no password with a resetkey, then send
|
# Create a user with no password with a resetkey, then send
|
||||||
# an email off about it.
|
# an email off about it.
|
||||||
resetkey = generate_unique_resetkey()
|
resetkey = generate_resetkey()
|
||||||
|
|
||||||
# By default, we grab the User account type to associate with.
|
# By default, we grab the User account type to associate with.
|
||||||
atype = db.query(models.AccountType,
|
atype = db.query(models.AccountType,
|
||||||
|
|
Loading…
Add table
Reference in a new issue