-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(idp-migration): redirection for account confirmation link #29003
Changes from 42 commits
e7221f1
8ff1e04
bb2c073
47e3ab0
a604829
906d610
403d2e9
eecb007
d17f024
6edfc34
b463c96
344f700
f0f31fb
5e84ba5
4de1d50
1d25e23
ef147ab
84493af
5bd84ae
a034b68
25a8f33
bb6bff2
e0c7fc5
1b9dd72
17d9104
816a98c
3cb038f
8d3ec8a
d87b53a
81c40f5
0b8caca
56c724d
2060f5c
665bdb7
e1d84c6
ddbc385
faa87c3
fe142eb
3e12cde
c13530b
c486177
a16b396
1b4d2b9
d87ace9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{% extends "sentry/emails/base.html" %} | ||
|
||
{% load i18n %} | ||
|
||
{% block main %} | ||
<h3>Sorry,</h3> | ||
<p> | ||
Something went wrong and your email could not be confirmed. Click the button below to go back to the login page. | ||
</p> | ||
|
||
<a href="{{ url }}" class="btn">Go back</a> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends "sentry/emails/base.html" %} | ||
|
||
{% load i18n %} | ||
|
||
{% block main %} | ||
<h3>Thank you!</h3> | ||
<p> | ||
Your email has been confirmed. Click the button below to log in to your Sentry account. | ||
</p> | ||
|
||
<form class="form-stacked" action="/auth/login/{{org}}/" method="post"> | ||
{% csrf_token %} | ||
<button class="btn btn-primary" type="submit">{% trans "Continue" %}</button> | ||
</form> | ||
{% endblock %} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,18 +1,23 @@ | ||||||
from django.http.response import HttpResponseNotFound, HttpResponseRedirect | ||||||
from django.http.response import HttpResponse | ||||||
from rest_framework.request import Request | ||||||
from rest_framework.response import Response | ||||||
|
||||||
from sentry.auth.idpmigration import get_redis_key, verify_account | ||||||
from sentry.utils.auth import get_login_url | ||||||
from sentry.auth.idpmigration import SSO_VERIFICATION_KEY, verify_account | ||||||
from sentry.web.frontend.base import BaseView | ||||||
from sentry.web.helpers import render_to_response | ||||||
|
||||||
|
||||||
def idp_confirm_email(request: Request, key: str) -> Response: | ||||||
verification_key = get_redis_key(key) | ||||||
if verify_account(key): | ||||||
request.session["confirm_account_verification_key"] = verification_key | ||||||
# TODO Change so it redirects to a confirmation page that needs to be made: Simple page with a confirmation msg and redirect to login | ||||||
login = get_login_url() | ||||||
redirect = HttpResponseRedirect(login) | ||||||
return redirect | ||||||
# TODO add view that shows key not found | ||||||
return HttpResponseNotFound() | ||||||
class IDPView(BaseView): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would prefer to have things named account_verification around this feature, as email_verification is a seperate feature we don't want to conflate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds good, i've changed the name of this class |
||||||
auth_required = False | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would add a quick comment explaining that the user using this endpoint is currently locked out of their account, so auth isn't required on this endpoint. |
||||||
|
||||||
def handle(self, request: Request, key: str) -> HttpResponse: | ||||||
# TODO get org from idpmigration later | ||||||
context = {"org": "sentry"} | ||||||
|
||||||
if verify_account(key): | ||||||
request.session[SSO_VERIFICATION_KEY] = key | ||||||
return render_to_response( | ||||||
"sentry/idp_account_verified.html", context=context, request=request | ||||||
) | ||||||
return render_to_response( | ||||||
"sentry/idp_account_not_verified.html", context=context, request=request | ||||||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we have extra time at the end of this project, we should see if it would be an easy swap to react views for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should i make tickets for these and work on it if i have time at the end/during spare cycles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good.