diff --git a/crates/templates/src/res/account-base.html b/crates/templates/src/res/account-base.html new file mode 100644 index 00000000..142ff745 --- /dev/null +++ b/crates/templates/src/res/account-base.html @@ -0,0 +1,45 @@ +{# +Copyright 2021 The Matrix.org Foundation C.I.C. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +#} + +{% extends "base.html" %} + +{% block content %} + +{% endblock content %} diff --git a/crates/templates/src/res/base.html b/crates/templates/src/res/base.html index f92b0193..a82a576a 100644 --- a/crates/templates/src/res/base.html +++ b/crates/templates/src/res/base.html @@ -27,32 +27,6 @@ limitations under the License. - - {% block content %}{% endblock content %} diff --git a/crates/templates/src/res/pages/account/emails.html b/crates/templates/src/res/pages/account/emails.html index 3d8f15bb..59935ac8 100644 --- a/crates/templates/src/res/pages/account/emails.html +++ b/crates/templates/src/res/pages/account/emails.html @@ -14,9 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. #} -{% extends "base.html" %} +{% extends "account-base.html" %} {% block content %} + {{ super() }} {% if current_session.user.primary_email %} {% set primary_email = current_session.user.primary_email.email %} {% else %} diff --git a/crates/templates/src/res/pages/account/index.html b/crates/templates/src/res/pages/account/index.html index 5fd3cafa..d414f261 100644 --- a/crates/templates/src/res/pages/account/index.html +++ b/crates/templates/src/res/pages/account/index.html @@ -14,9 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. #} -{% extends "base.html" %} +{% extends "account-base.html" %} {% block content %} + {{ super() }}

Manage my account

diff --git a/crates/templates/src/res/pages/account/password.html b/crates/templates/src/res/pages/account/password.html index 28723a23..7e70538a 100644 --- a/crates/templates/src/res/pages/account/password.html +++ b/crates/templates/src/res/pages/account/password.html @@ -14,9 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. #} -{% extends "base.html" %} +{% extends "account-base.html" %} {% block content %} + {{ super() }}

Change my password

diff --git a/crates/templates/src/res/pages/consent.html b/crates/templates/src/res/pages/consent.html index f15a82b3..e291318b 100644 --- a/crates/templates/src/res/pages/consent.html +++ b/crates/templates/src/res/pages/consent.html @@ -16,81 +16,81 @@ limitations under the License. {% extends "base.html" %} -{% block navbar_start %} - {{ back_to_client::link( - text="← Back", - uri=grant.redirect_uri, - mode=grant.response_mode, - params=dict(error="access_denied", state=grant.state) - ) }} -{% endblock %} - {% block content %}
- -
-

Authorize {{ grant.client.client_name | default(value=grant.client.client_id) }}

-
- -
-
-
- {% if grant.client.logo_uri %} - - {% endif %} +
+ +
+
+
+ {% if grant.client.logo_uri %} + + {% endif %} +
+

{{ grant.client.client_name | default(value=grant.client.client_id) }}

+

at {{ grant.redirect_uri }}

+

wants to access your Matrix account

-
-
- {{ grant.client.client_name }} -
+
+
+

This will allow {{ grant.client.client_name | default(value=grant.client.client_id) }} to:

- {% if grant.client.client_uri %} - - {% endif %} +

+

    + {% for scope in grant.scope | split(pat=" ") %} + {% if scope == "openid" %} +
  • See your profile info and contact details
  • + {% elif scope is matching("^urn:matrix:device:") %} +
  • View your existing messages and data
  • +
  • Send new messages on your behalf
  • + {% else %} +
  • {{ scope }}
  • + {% endif %} + {% endfor %} +
+

+

Make sure that you trust {{ grant.client.client_name }}

+

+ You may be sharing sensitive information with this site or app. + {% if grant.client.policy_uri or grant.client.tos_uri %} + Find out how {{ grant.client.client_name }} will handle your data by reviewing it's + {% if grant.client.policy_uri %} + privacy policy{% if not grant.client.tos_uri %}.{% endif %} + {% endif %} + {% if grant.client.policy_uri and grant.client.tos_uri%} + and + {% endif %} + {% if grant.client.tos_uri %} + terms of service. + {% endif %} + {% endif %} +

+
- {% if grant.client.policy_uri or grant.client.tos_uri %} -
- {% if grant.client.policy_uri %} - {{ button::link_ghost(href=grant.client.policy_uri, text="Privacy policy", class="flex-auto mx-2") }} - {% endif %} + - {% if grant.client.tos_uri %} - {{ button::link_ghost(href=grant.client.tos_uri, text="Terms of services", class="flex-auto mx-2") }} - {% endif %} +
+ {{ back_to_client::link( + text="Cancel", + class=button::text_class(), + uri=grant.redirect_uri, + mode=grant.response_mode, + params=dict(error="access_denied", state=grant.state) + ) }} + {{ button::button(text="Allow") }}
- {% endif %} + +
+
+ +
+ Not {{ current_session.user.username }}? + {{ button::button_text(text="Sign out", name="logout", type="submit") }} +
+
- -
Scope: {{ grant.scope }}
- - - -
- {{ button::button(text="Allow") }} - - {{ back_to_client::link( - text="Deny", - class=button::plain_error_class(), - uri=grant.redirect_uri, - mode=grant.response_mode, - params=dict(error="access_denied", state=grant.state) - ) }} -
- -
- -
- {{ back_to_client::link( - text="Cancel", - class=button::text_class(), - uri=grant.redirect_uri, - mode=grant.response_mode, - params=dict(error="access_denied", state=grant.state) - ) }} +
{% endblock content %} - diff --git a/crates/templates/src/res/pages/index.html b/crates/templates/src/res/pages/index.html index e7174af1..1d81bce0 100644 --- a/crates/templates/src/res/pages/index.html +++ b/crates/templates/src/res/pages/index.html @@ -14,9 +14,10 @@ See the License for the specific language governing permissions and limitations under the License. #} -{% extends "base.html" %} +{% extends "account-base.html" %} {% block content %} + {{ super() }}

Matrix Authentication Service

diff --git a/crates/templates/src/res/pages/login.html b/crates/templates/src/res/pages/login.html index 83f889c7..275b58c3 100644 --- a/crates/templates/src/res/pages/login.html +++ b/crates/templates/src/res/pages/login.html @@ -34,30 +34,32 @@ limitations under the License.

Sign in

- {% if next and next.kind == "continue_authorization_grant" %} -

to continue to {{ next.grant.client.client_name | default(value=next.grand.client.client_id) }}

- {% else %} -

Use your existing account

- {% endif %} +

Please sign in to continue:

{# TODO: errors #} {{ field::input(label="Username", name="username") }} {{ field::input(label="Password", name="password", type="password") }} - {{ button::button(text="Next") }} - {{ button::link_text(text="Create account", href=register_link) }} + {% if next and next.kind == "continue_authorization_grant" %} +
+ {{ back_to_client::link( + text="Cancel", + class=button::text_class(), + uri=next.grant.redirect_uri, + mode=next.grant.response_mode, + params=dict(error="access_denied", state=next.grant.state) + ) }} + {{ button::button(text="Next") }} +
+ {% else %} +
+ {{ button::button(text="Next") }} +
+ {% endif %} +
+ Don't have an account yet? + {{ button::link_text(text="Create an account", href=register_link) }} +
- - {% if next and next.kind == "continue_authorization_grant" %} -
- {{ back_to_client::link( - text="Cancel", - class=button::text_class(), - uri=next.grant.redirect_uri, - mode=next.grant.response_mode, - params=dict(error="access_denied", state=next.grant.state) - ) }} -
- {% endif %} {% endblock content %} diff --git a/crates/templates/src/res/pages/reauth.html b/crates/templates/src/res/pages/reauth.html index 1b286aae..a23736be 100644 --- a/crates/templates/src/res/pages/reauth.html +++ b/crates/templates/src/res/pages/reauth.html @@ -16,32 +16,47 @@ limitations under the License. {% extends "base.html" %} -{% block navbar_start %} - {% if next and next.kind == "continue_authorization_grant" %} - {{ back_to_client::link( - text="← Back", - uri=next.grant.redirect_uri, - mode=next.grant.response_mode, - params=dict(error="access_denied", state=next.grant.state) - ) }} - {% endif %} -{% endblock %} - {% block content %}
-
-
-

Hi {{ current_session.user.username }}

-

To continue, first verify it's you:

+
+ +
+

Hi {{ current_session.user.username }}

+

To continue, please verify it's you:

+
+ + {# TODO: errors #} + {{ field::input(label="Password", name="password", type="password") }} + {% if next and next.kind == "continue_authorization_grant" %} +
+ {{ back_to_client::link( + text="Cancel", + class=button::text_class(), + uri=next.grant.redirect_uri, + mode=next.grant.response_mode, + params=dict(error="access_denied", state=next.grant.state) + ) }} + {{ button::button(text="Next") }} +
+ {% else %} +
+ {{ button::button(text="Next") }} +
+ {% endif %} + +
+
+ +
+ Not {{ current_session.user.username }}? + {{ button::button_text(text="Sign out", name="logout", type="submit") }} +
+
- - {# TODO: errors #} - {{ field::input(label="Password", name="password", type="password") }} - {{ button::button(text="Next") }} - +
-
+ {% endblock content %} diff --git a/crates/templates/src/res/pages/register.html b/crates/templates/src/res/pages/register.html index 4f784d06..50c532ff 100644 --- a/crates/templates/src/res/pages/register.html +++ b/crates/templates/src/res/pages/register.html @@ -33,31 +33,37 @@ limitations under the License.
-

Create your account

- {% if next and next.kind == "continue_authorization_grant" %} -

to continue to {{ next.grant.client.client_name | default(value=next.grand.client.client_id) }}

- {% endif %} +

Create an account

+

Please create an account to get started:

{# TODO: errors #} {{ field::input(label="Username", name="username") }} {{ field::input(label="Password", name="password", type="password") }} {{ field::input(label="Confirm Password", name="password_confirm", type="password") }} - {{ button::button(text="Next") }} - {# TODO: proper link #} - {{ button::link_text(text="Sign in instead", href=login_link) }} + + {% if next and next.kind == "continue_authorization_grant" %} +
+ {{ back_to_client::link( + text="Cancel", + class=button::text_class(), + uri=next.grant.redirect_uri, + mode=next.grant.response_mode, + params=dict(error="access_denied", state=next.grant.state) + ) }} + {{ button::button(text="Next") }} +
+ {% else %} +
+ {{ button::button(text="Next") }} +
+ {% endif %} +
+ Already have an account? + {# TODO: proper link #} + {{ button::link_text(text="Sign in instead", href=login_link) }} +
- {% if next and next.kind == "continue_authorization_grant" %} -
- {{ back_to_client::link( - text="Cancel", - class=button::text_class(), - uri=next.grant.redirect_uri, - mode=next.grant.response_mode, - params=dict(error="access_denied", state=next.grant.state) - ) }} -
- {% endif %} {% endblock content %} diff --git a/docs/usage/usage.md b/docs/usage/usage.md index 8b80bc5c..1b95e111 100644 --- a/docs/usage/usage.md +++ b/docs/usage/usage.md @@ -35,7 +35,7 @@ docker run --rm \ ## Registering, logging in and out Through the interface, users are able to create an account by clicking the `Register` button on the top right (or going to [`/register`](http://localhost:8080/register). -They can then end their session by clicking the `Log out` button and log back in. +They can then end their session by clicking the `Sign out` button and sign back in. ## Playing around with the playground