Requested by Quokka to make logins redirect back to the page
This commit is contained in:
parent
6b5d67f429
commit
1f6dd90118
2 changed files with 16 additions and 5 deletions
|
@ -556,7 +556,7 @@ def ArticlePage(server, url):
|
||||||
if referrers:
|
if referrers:
|
||||||
for referrer in referrers:
|
for referrer in referrers:
|
||||||
# Filtering out probably bad links.
|
# Filtering out probably bad links.
|
||||||
if "https://" in referrer and ".onion" not in referrer:
|
if ( "https://" in referrer and ".onion" not in referrer ) or rank(user.get("username", "")) == 0:
|
||||||
html = html + Safe(referrer) + " : 👁 "+str(referrers[referrer]) + "<br>\n"
|
html = html + Safe(referrer) + " : 👁 "+str(referrers[referrer]) + "<br>\n"
|
||||||
|
|
||||||
|
|
||||||
|
@ -893,6 +893,7 @@ def LoginPage(server):
|
||||||
f = Set.Folder()
|
f = Set.Folder()
|
||||||
|
|
||||||
wrongname = server.parsed.get("wrong", [""])[0]
|
wrongname = server.parsed.get("wrong", [""])[0]
|
||||||
|
redirect = server.parsed.get("redirect", [""])[0]
|
||||||
|
|
||||||
# Generating <head>
|
# Generating <head>
|
||||||
html = head(title = "Login",
|
html = head(title = "Login",
|
||||||
|
@ -921,6 +922,12 @@ def LoginPage(server):
|
||||||
<img style="vertical-align: middle" src="/icon/lock">
|
<img style="vertical-align: middle" src="/icon/lock">
|
||||||
<input class="button" style="width:90%" maxlength="500" id="password" type="password" required="" name="password" placeholder="Password..."></input><br>
|
<input class="button" style="width:90%" maxlength="500" id="password" type="password" required="" name="password" placeholder="Password..."></input><br>
|
||||||
|
|
||||||
|
"""
|
||||||
|
if redirect:
|
||||||
|
html = html + '<input type="hidden" name="redirect" value="'+Safe(redirect)+'">'
|
||||||
|
|
||||||
|
html = html + """
|
||||||
|
|
||||||
<button class="button" type="submit">
|
<button class="button" type="submit">
|
||||||
<img style="vertical-align: middle" src="/icon/unlock">
|
<img style="vertical-align: middle" src="/icon/unlock">
|
||||||
Login
|
Login
|
||||||
|
@ -1717,7 +1724,7 @@ def LoginButton(server):
|
||||||
html = '<div class="login_fixed">'
|
html = '<div class="login_fixed">'
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
html = html + '<a class="button" href="/login">'
|
html = html + '<a class="button" href="/login?redirect='+urllib.parse.quote_plus(server.path)+'">'
|
||||||
html = html + '<img alt="[icon user]" style="vertical-align: middle" src="/icon/unlock"> Login'
|
html = html + '<img alt="[icon user]" style="vertical-align: middle" src="/icon/unlock"> Login'
|
||||||
html = html + '</a>'
|
html = html + '</a>'
|
||||||
|
|
||||||
|
@ -1801,6 +1808,8 @@ def Login(server):
|
||||||
password = server.parsed.get("password" , [""])[0]
|
password = server.parsed.get("password" , [""])[0]
|
||||||
hashed = hashlib.sha512(password.encode("utf-8")).hexdigest()
|
hashed = hashlib.sha512(password.encode("utf-8")).hexdigest()
|
||||||
|
|
||||||
|
redirect = server.parsed.get("redirect" , [""])[0]
|
||||||
|
|
||||||
Accounts = accounts()
|
Accounts = accounts()
|
||||||
|
|
||||||
# Failed authentication
|
# Failed authentication
|
||||||
|
@ -1852,8 +1861,10 @@ def Login(server):
|
||||||
json.dump(article, save, indent=4)
|
json.dump(article, save, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
if not redirect:
|
||||||
Redirect(server, "/settings")
|
Redirect(server, "/settings")
|
||||||
|
else:
|
||||||
|
Redirect(server, redirect)
|
||||||
|
|
||||||
def Register(server):
|
def Register(server):
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ def search_convert(s):
|
||||||
r = r + i
|
r = r + i
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def convert(filename, isfile=True, fullpath=True):
|
def convert(filename, isfile=True, fullpath=False):
|
||||||
|
|
||||||
|
|
||||||
if fullpath:
|
if fullpath:
|
||||||
|
|
Loading…
Add table
Reference in a new issue