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:
|
||||
for referrer in referrers:
|
||||
# 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"
|
||||
|
||||
|
||||
|
@ -893,6 +893,7 @@ def LoginPage(server):
|
|||
f = Set.Folder()
|
||||
|
||||
wrongname = server.parsed.get("wrong", [""])[0]
|
||||
redirect = server.parsed.get("redirect", [""])[0]
|
||||
|
||||
# Generating <head>
|
||||
html = head(title = "Login",
|
||||
|
@ -921,6 +922,12 @@ def LoginPage(server):
|
|||
<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>
|
||||
|
||||
"""
|
||||
if redirect:
|
||||
html = html + '<input type="hidden" name="redirect" value="'+Safe(redirect)+'">'
|
||||
|
||||
html = html + """
|
||||
|
||||
<button class="button" type="submit">
|
||||
<img style="vertical-align: middle" src="/icon/unlock">
|
||||
Login
|
||||
|
@ -1717,7 +1724,7 @@ def LoginButton(server):
|
|||
html = '<div class="login_fixed">'
|
||||
|
||||
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 + '</a>'
|
||||
|
||||
|
@ -1801,6 +1808,8 @@ def Login(server):
|
|||
password = server.parsed.get("password" , [""])[0]
|
||||
hashed = hashlib.sha512(password.encode("utf-8")).hexdigest()
|
||||
|
||||
redirect = server.parsed.get("redirect" , [""])[0]
|
||||
|
||||
Accounts = accounts()
|
||||
|
||||
# Failed authentication
|
||||
|
@ -1852,8 +1861,10 @@ def Login(server):
|
|||
json.dump(article, save, indent=4)
|
||||
|
||||
|
||||
|
||||
if not redirect:
|
||||
Redirect(server, "/settings")
|
||||
else:
|
||||
Redirect(server, redirect)
|
||||
|
||||
def Register(server):
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ def search_convert(s):
|
|||
r = r + i
|
||||
return r
|
||||
|
||||
def convert(filename, isfile=True, fullpath=True):
|
||||
def convert(filename, isfile=True, fullpath=False):
|
||||
|
||||
|
||||
if fullpath:
|
||||
|
|
Loading…
Add table
Reference in a new issue