forked from mirrors/bookwyrm
handle username errors in remote follow form
This commit is contained in:
parent
6abf5d6910
commit
feaf0d5e52
2 changed files with 8 additions and 0 deletions
|
@ -33,6 +33,11 @@
|
||||||
<p>{% blocktrans %}Something went wrong trying to follow <strong>{{ account }}</strong>{% endblocktrans %}</p>
|
<p>{% blocktrans %}Something went wrong trying to follow <strong>{{ account }}</strong>{% endblocktrans %}</p>
|
||||||
<p>{% trans 'Check you have the correct username before trying again.' %}</p>
|
<p>{% trans 'Check you have the correct username before trying again.' %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
{% elif error == 'remote_subscribe' %}
|
||||||
|
<div class="notification is-warning has-text-centered">
|
||||||
|
<p>{% blocktrans %}Something went wrong trying to follow from <strong>{{ account }}</strong>{% endblocktrans %}</p>
|
||||||
|
<p>{% trans 'Check you have the correct username before trying again.' %}</p>
|
||||||
|
</div>
|
||||||
{% elif error == 'is_blocked' %}
|
{% elif error == 'is_blocked' %}
|
||||||
<div class="notification is-danger has-text-centered">
|
<div class="notification is-danger has-text-centered">
|
||||||
<p>{% blocktrans %}You have blocked <strong>{{ account }}</strong>{% endblocktrans %}</p>
|
<p>{% blocktrans %}You have blocked <strong>{{ account }}</strong>{% endblocktrans %}</p>
|
||||||
|
|
|
@ -148,5 +148,8 @@ def remote_follow(request):
|
||||||
"""direct user to follow from remote account using ostatus subscribe protocol"""
|
"""direct user to follow from remote account using ostatus subscribe protocol"""
|
||||||
remote_user = request.POST.get("remote_user")
|
remote_user = request.POST.get("remote_user")
|
||||||
template = subscribe_remote_webfinger(remote_user)
|
template = subscribe_remote_webfinger(remote_user)
|
||||||
|
if template is None:
|
||||||
|
data = {"account": remote_user, "user": None, "error": "remote_subscribe"}
|
||||||
|
return TemplateResponse(request, "ostatus/subscribe.html", data)
|
||||||
url = template.replace("{uri}", request.POST.get("user"))
|
url = template.replace("{uri}", request.POST.get("user"))
|
||||||
return redirect(url)
|
return redirect(url)
|
||||||
|
|
Loading…
Reference in a new issue