Skip to content

Commit

Permalink
feat: keep position in authorization area
Browse files Browse the repository at this point in the history
  • Loading branch information
djangoliv committed Mar 4, 2021
1 parent b0d9f9e commit e5ace25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion nativeauthenticator/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ async def get(self):
'autorization-area.html',
ask_email=self.authenticator.ask_email_on_signup,
users=self.db.query(UserInfo).all(),
current_user=self.get_argument('current_user', '')
)
self.finish(html)

Expand All @@ -121,7 +122,7 @@ class ChangeAuthorizationHandler(LocalBase):
@admin_only
async def get(self, slug):
UserInfo.change_authorization(self.db, slug)
self.redirect(self.hub.base_url + 'authorize')
self.redirect(self.hub.base_url + f'authorize?current_user={slug}')


class ChangePasswordHandler(LocalBase):
Expand Down
9 changes: 6 additions & 3 deletions nativeauthenticator/templates/autorization-area.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h1>Authorization Area</h1>
<tbody>
{% for user in users %}
{% if user.is_authorized %}
<tr class="success">
<tr class="success" id={{ user.username }}>
<td>{{ user.username }}</td>
{% if ask_email %}
<td>{{ user.email }}</td>
Expand All @@ -28,7 +28,7 @@ <h1>Authorization Area</h1>
</td>
<td></td>
{% else %}
<tr>
<tr id={{ user.username }}>
<td>{{ user.username }}</td>
{% if ask_email %}
<td>{{ user.email }}</td>
Expand All @@ -47,4 +47,7 @@ <h1>Authorization Area</h1>
</tbody>
</table>
</div>
{% endblock %}
<script>
window.location.hash = '#{{ current_user }}';
</script>
{% endblock %}

0 comments on commit e5ace25

Please sign in to comment.