forked from rDrama/rDrama
fix redirection on signup
parent
1706b15ce6
commit
11afc5cff1
|
@ -14,7 +14,7 @@ def login_get(v):
|
||||||
|
|
||||||
redir = request.values.get("redirect", "/")
|
redir = request.values.get("redirect", "/")
|
||||||
if redir:
|
if redir:
|
||||||
redir = redir.replace("/logged_out", "").strip()
|
redir = redir.replace("/logged_out", "").strip().rstrip('?')
|
||||||
if not is_site_url(redir): redir = "/"
|
if not is_site_url(redir): redir = "/"
|
||||||
if v: return redirect(redir)
|
if v: return redirect(redir)
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ def login_post():
|
||||||
|
|
||||||
redir = request.values.get("redirect")
|
redir = request.values.get("redirect")
|
||||||
if redir:
|
if redir:
|
||||||
redir = redir.replace("/logged_out", "").strip()
|
redir = redir.replace("/logged_out", "").strip().rstrip('?')
|
||||||
if is_site_url(redir): return redirect(redir)
|
if is_site_url(redir): return redirect(redir)
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
|
|
||||||
|
@ -213,12 +213,18 @@ def sign_up_get(v):
|
||||||
|
|
||||||
error = request.values.get("error")
|
error = request.values.get("error")
|
||||||
|
|
||||||
|
redir = request.values.get("redirect", "/")
|
||||||
|
if redir:
|
||||||
|
redir = redir.replace("/logged_out", "").strip().rstrip('?')
|
||||||
|
if not is_site_url(redir): redir = "/"
|
||||||
|
|
||||||
return render_template("sign_up.html",
|
return render_template("sign_up.html",
|
||||||
formkey=formkey,
|
formkey=formkey,
|
||||||
now=now,
|
now=now,
|
||||||
ref_user=ref_user,
|
ref_user=ref_user,
|
||||||
hcaptcha=HCAPTCHA_SITEKEY,
|
hcaptcha=HCAPTCHA_SITEKEY,
|
||||||
error=error
|
error=error,
|
||||||
|
redirect=redir
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -361,14 +367,19 @@ def sign_up_post(v):
|
||||||
|
|
||||||
session["lo_user"] = new_user.id
|
session["lo_user"] = new_user.id
|
||||||
|
|
||||||
carp = get_account(CARP_ID)
|
if CARP_ID:
|
||||||
new_follow = Follow(user_id=new_user.id, target_id=carp.id)
|
carp = get_account(CARP_ID)
|
||||||
g.db.add(new_follow)
|
new_follow = Follow(user_id=new_user.id, target_id=carp.id)
|
||||||
carp.stored_subscriber_count += 1
|
g.db.add(new_follow)
|
||||||
g.db.add(carp)
|
carp.stored_subscriber_count += 1
|
||||||
send_notification(carp.id, f"A new user - @{new_user.username} - has followed you automatically!")
|
g.db.add(carp)
|
||||||
|
send_notification(carp.id, f"A new user - @{new_user.username} - has followed you automatically!")
|
||||||
|
|
||||||
return redirect(SITE_FULL)
|
redir = request.values.get("redirect")
|
||||||
|
if redir:
|
||||||
|
redir = redir.replace("/logged_out", "").strip().rstrip('?')
|
||||||
|
if is_site_url(redir): return redirect(redir)
|
||||||
|
return redirect('/')
|
||||||
|
|
||||||
|
|
||||||
@app.get("/forgot")
|
@app.get("/forgot")
|
||||||
|
|
|
@ -79,9 +79,8 @@
|
||||||
<button class="btn btn-primary login w-100 mt-3" id="login_button">Sign In</button>
|
<button class="btn btn-primary login w-100 mt-3" id="login_button">Sign In</button>
|
||||||
|
|
||||||
<div class="text-center text-muted text-small mt-5 mb-3">
|
<div class="text-center text-muted text-small mt-5 mb-3">
|
||||||
Don't have an account? <a href="/signup{{'?redirect='+redirect if redirect else ''}}" class="font-weight-bold toggle-login">Sign up</a>
|
Don't have an account? <a href="/signup{{'?redirect='+redirect if redirect else ''}}" class="font-weight-bold toggle-login">Sign up</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -113,10 +113,9 @@
|
||||||
|
|
||||||
<button class="btn btn-primary login w-100 mt-3" id="register_button">Register</button>
|
<button class="btn btn-primary login w-100 mt-3" id="register_button">Register</button>
|
||||||
|
|
||||||
<div class="text-center text-muted text-small mt-2 mb-0">
|
<div class="text-center text-muted text-small mt-5 mb-3">
|
||||||
Already have an account? <a href="/login{{'?redirect='+redirect if redirect else ''}}" class="font-weight-bold toggle-login">Log in</a>
|
Already have an account? <a href="/login{{'?redirect='+redirect if redirect else ''}}" class="font-weight-bold toggle-login">Log in</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -60,11 +60,9 @@
|
||||||
<label>Referral code</label>
|
<label>Referral code</label>
|
||||||
<input autocomplete="off" type="text" class="form-control copy-link" readonly value="{{SITE_FULL}}/signup?ref={{request.values.get('ref')}}" data-clipboard-text="{{SITE_FULL}}/signup?ref={{request.values.get('ref')}}">
|
<input autocomplete="off" type="text" class="form-control copy-link" readonly value="{{SITE_FULL}}/signup?ref={{request.values.get('ref')}}" data-clipboard-text="{{SITE_FULL}}/signup?ref={{request.values.get('ref')}}">
|
||||||
|
|
||||||
<div class="text-center mt-5 mb-3">
|
<div class="text-center text-muted text-small mt-5 mb-3">
|
||||||
Already have an account? <a href="/login" class="font-weight-bold text-small toggle-login">Log in.</a>
|
Already have an account? <a href="/login{{'?redirect='+redirect if redirect else ''}}" class="font-weight-bold toggle-login">Log in</a>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue