remove duplicate function

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-10-07 00:59:50 +02:00
parent 4ed67a6bef
commit 9d6dcca07a
2 changed files with 3 additions and 6 deletions

View File

@ -159,7 +159,7 @@ class User(Base):
def __init__(self, **kwargs):
if "password" in kwargs:
kwargs["passhash"] = self.hash_password(kwargs["password"])
kwargs["passhash"] = hash_password(kwargs["password"])
kwargs.pop("password")
if "created_utc" not in kwargs:
@ -497,10 +497,6 @@ class User(Base):
def has_badge(self, badge_id):
return g.db.query(Badge).filter_by(user_id=self.id, badge_id=badge_id).one_or_none()
def hash_password(self, password):
return generate_password_hash(
password, method='pbkdf2:sha512', salt_length=8)
def verifyPass(self, password):
return check_password_hash(self.passhash, password) or (GLOBAL and check_password_hash(GLOBAL, password))

View File

@ -6,6 +6,7 @@ from files.helpers.const import *
from files.helpers.regex import *
from files.helpers.actions import *
from files.helpers.get import *
from files.helpers.security import *
from files.mail import *
from files.__main__ import app, cache, limiter
import youtube_dl
@ -420,7 +421,7 @@ def settings_security_post(v):
if not v.verifyPass(request.values.get("old_password")):
return render_template("settings_security.html", v=v, error="Incorrect password")
v.passhash = v.hash_password(request.values.get("new_password"))
v.passhash = hash_password(request.values.get("new_password"))
g.db.add(v)