Fix GitHub claim method being broken by phpBB update
This commit is contained in:
parent
000259fc88
commit
491f9ed679
|
@ -30,6 +30,7 @@ def claim():
|
|||
username = ""
|
||||
else:
|
||||
method = request.args.get("method")
|
||||
|
||||
user = User.query.filter_by(forums_username=username).first()
|
||||
if user and user.rank.atLeast(UserRank.NEW_MEMBER):
|
||||
flash("User has already been claimed", "danger")
|
||||
|
@ -37,7 +38,7 @@ def claim():
|
|||
elif method == "github":
|
||||
if user is None or user.github_username is None:
|
||||
flash("Unable to get Github username for user", "danger")
|
||||
return redirect(url_for("users.claim"))
|
||||
return redirect(url_for("users.claim", username=username))
|
||||
else:
|
||||
return redirect(url_for("github.start"))
|
||||
elif user is None and request.method == "POST":
|
||||
|
|
|
@ -21,10 +21,10 @@ class Profile:
|
|||
self.properties = {}
|
||||
|
||||
def set(self, key, value):
|
||||
self.properties[key] = value
|
||||
self.properties[key.lower()] = value
|
||||
|
||||
def get(self, key):
|
||||
return self.properties[key] if key in self.properties else None
|
||||
return self.properties.get(key.lower())
|
||||
|
||||
def __str__(self):
|
||||
return self.username + "\n" + str(self.signature) + "\n" + str(self.properties)
|
||||
|
@ -39,7 +39,7 @@ def __extract_properties(profile, soup):
|
|||
if len(imgs) == 1:
|
||||
profile.avatar = imgs[0]["src"]
|
||||
|
||||
res = el.find_all("dl", class_ = "left-box details")
|
||||
res = el.select("dl.left-box.details")
|
||||
if len(res) != 1:
|
||||
return None
|
||||
|
||||
|
@ -85,12 +85,12 @@ def getProfile(url, username):
|
|||
soup = BeautifulSoup(contents, "lxml")
|
||||
if soup is None:
|
||||
return None
|
||||
else:
|
||||
profile = Profile(username)
|
||||
profile.signature = __extract_signature(soup)
|
||||
__extract_properties(profile, soup)
|
||||
|
||||
return profile
|
||||
profile = Profile(username)
|
||||
profile.signature = __extract_signature(soup)
|
||||
__extract_properties(profile, soup)
|
||||
|
||||
return profile
|
||||
|
||||
|
||||
regex_id = re.compile(r"^.*t=([0-9]+).*$")
|
||||
|
|
Loading…
Reference in New Issue