2023-07-19 18:14:04 +00:00
|
|
|
{% macro user_card(user) %}
|
2022-09-13 13:14:49 +00:00
|
|
|
{% from 'macros.twig' import avatar %}
|
2023-08-03 12:40:30 +00:00
|
|
|
{% if user.info is defined %}
|
|
|
|
{% set colour = user.colour %}
|
|
|
|
{% set info = user.info %}
|
|
|
|
{% set ftopics = user.ftopics %}
|
|
|
|
{% set fposts = user.fposts %}
|
|
|
|
{% else %}
|
|
|
|
{% set colour = user.user_colour %}
|
|
|
|
{% set info = {
|
|
|
|
'id': user.user_id,
|
|
|
|
'name': user.username,
|
|
|
|
'hasTitle': user.user_title is defined and user.user_title is not empty,
|
|
|
|
'title': user.user_title|default(''),
|
|
|
|
'hasCountryCode': user.user_country is defined and user.user_country != 'XX',
|
|
|
|
'countryCode': user.user_country|default('XX'),
|
|
|
|
'hasLastActive': user.user_active is defined and user.user_active > 0,
|
|
|
|
'lastActiveTime': user.user_active,
|
|
|
|
'createdTime': user.user_created
|
|
|
|
} %}
|
|
|
|
{% set ftopics = user.user_count_topics %}
|
|
|
|
{% set fposts = user.user_count_posts %}
|
|
|
|
{% endif %}
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-03 12:40:30 +00:00
|
|
|
<div class="usercard" style="--accent-colour: {{ colour }}">
|
2022-09-13 13:14:49 +00:00
|
|
|
<div class="usercard__background"></div>
|
2023-08-03 12:40:30 +00:00
|
|
|
<a class="usercard__link" href="{{ url('user-profile', {'user': info.id}) }}" title="Visit {{ info.name }}'{{ info.name|last|lower == 's' ? '' : 's' }} profile"></a>
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__avatar">
|
2023-08-03 12:40:30 +00:00
|
|
|
{{ avatar(info.id, 50, info.name) }}
|
2023-07-19 18:14:04 +00:00
|
|
|
</div>
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__details">
|
|
|
|
<div class="usercard__details_inner">
|
2023-08-02 22:12:47 +00:00
|
|
|
<div class="usercard__details__username">
|
2023-08-03 12:40:30 +00:00
|
|
|
{{ info.name }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
|
2023-08-03 12:40:30 +00:00
|
|
|
{% if info.hasTitle %}
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__details__title">
|
2023-08-03 12:40:30 +00:00
|
|
|
{{ info.title }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2023-08-03 12:40:30 +00:00
|
|
|
{% if info.hasCountryCode %}
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__details__country">
|
2023-08-03 12:40:30 +00:00
|
|
|
<div class="flag flag--{{ info.countryCode|lower }}"></div>
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__details__country__name">
|
2023-08-03 12:40:30 +00:00
|
|
|
{{ info.countryCode|country_name }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__stats">
|
2023-08-03 12:40:30 +00:00
|
|
|
{% if ftopics > 0 %}
|
|
|
|
<a class="usercard__stat" href="{{ url('user-profile-forum-topics', {'user': info.id}) }}">
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__stat__name">Topics</div>
|
2023-08-03 12:40:30 +00:00
|
|
|
<div class="usercard__stat__value">{{ ftopics|number_format }}</div>
|
2023-07-19 18:14:04 +00:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-03 12:40:30 +00:00
|
|
|
{% if fposts > 0 %}
|
|
|
|
<a class="usercard__stat" href="{{ url('user-profile-forum-posts', {'user': info.id}) }}">
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__stat__name">Posts</div>
|
2023-08-03 12:40:30 +00:00
|
|
|
<div class="usercard__stat__value">{{ fposts|number_format }}</div>
|
2023-07-19 18:14:04 +00:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-03 12:40:30 +00:00
|
|
|
{% if info.hasLastActive %}
|
|
|
|
<div class="usercard__stat usercard__stat--wide" title="{{ info.lastActiveTime|date('r') }}">
|
2023-07-19 18:14:04 +00:00
|
|
|
<div class="usercard__stat__name">Last seen</div>
|
2023-08-03 12:40:30 +00:00
|
|
|
<div class="usercard__stat__value"><time datetime="{{ info.lastActiveTime|date('c') }}">{{ info.lastActiveTime|time_format }}</time></div>
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
2023-07-19 18:14:04 +00:00
|
|
|
{% endif %}
|
2022-09-13 13:14:49 +00:00
|
|
|
|
2023-08-03 12:40:30 +00:00
|
|
|
<div class="usercard__stat usercard__stat--wide" title="{{ info.createdTime|date('r') }}">
|
2023-08-02 22:12:47 +00:00
|
|
|
<div class="usercard__stat__name">Joined</div>
|
2023-08-03 12:40:30 +00:00
|
|
|
<div class="usercard__stat__value"><time datetime="{{ info.createdTime|date('c') }}">{{ info.createdTime|time_format }}</time></div>
|
2023-08-02 22:12:47 +00:00
|
|
|
</div>
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro user_session(session, is_current_session) %}
|
|
|
|
{% from '_layout/input.twig' import input_hidden, input_csrf, input_checkbox_raw %}
|
|
|
|
|
|
|
|
<div class="settings__session{% if is_current_session %} settings__session--current{% endif %}" id="session-{{ session.id }}">
|
|
|
|
<div class="settings__session__container">
|
|
|
|
<div class="settings__session__important">
|
2023-07-28 20:06:12 +00:00
|
|
|
<div class="flag flag--{{ session.countryCode|lower }} settings__session__flag" title="{{ session.countryCode|country_name }}">{{ session.countryCode }}</div>
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
<div class="settings__session__description">
|
2023-07-21 12:47:56 +00:00
|
|
|
{{ session.clientInfo }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<form class="settings__session__actions" method="post" action="{{ url('settings-sessions') }}">
|
|
|
|
{{ input_csrf() }}
|
2023-07-28 20:06:12 +00:00
|
|
|
{{ input_hidden('session', session.id) }}
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
<button class="settings__session__action" title="{{ is_current_session ? 'Logout' : 'End Session' }}">
|
|
|
|
{% if is_current_session %}
|
|
|
|
<i class="fas fa-sign-out-alt"></i>
|
|
|
|
{% else %}
|
|
|
|
<i class="fas fa-times-circle"></i>
|
|
|
|
{% endif %}
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__session__details">
|
|
|
|
<div class="settings__session__detail">
|
|
|
|
<div class="settings__session__detail__title">
|
|
|
|
Created from IP
|
|
|
|
</div>
|
|
|
|
<div class="settings__session__detail__value">
|
2023-07-28 20:06:12 +00:00
|
|
|
{{ session.firstRemoteAddress }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% if session.hasLastRemoteAddress %}
|
|
|
|
<div class="settings__session__detail">
|
|
|
|
<div class="settings__session__detail__title">
|
|
|
|
Last used from IP
|
|
|
|
</div>
|
|
|
|
<div class="settings__session__detail__value">
|
|
|
|
{{ session.lastRemoteAddress }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="settings__session__detail" title="{{ session.createdTime|date('r') }}">
|
|
|
|
<div class="settings__session__detail__title">
|
|
|
|
Created
|
|
|
|
</div>
|
|
|
|
<time class="settings__session__detail__value" datetime="{{ session.createdTime|date('c') }}">
|
2023-07-18 23:12:47 +00:00
|
|
|
{{ session.createdTime|time_format }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</time>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__session__detail" title="{{ session.expiresTime|date('r') }}">
|
|
|
|
<div class="settings__session__detail__title">
|
2023-07-28 20:06:12 +00:00
|
|
|
Expires{% if not session.shouldBumpExpires %} (static){% endif %}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
<time class="settings__session__detail__value" datetime="{{ session.expiresTime|date('c') }}">
|
2023-07-18 23:12:47 +00:00
|
|
|
{{ session.expiresTime|time_format }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</time>
|
|
|
|
</div>
|
|
|
|
|
2023-07-28 20:06:12 +00:00
|
|
|
{% if session.hasLastActive %}
|
|
|
|
<div class="settings__session__detail" title="{{ session.lastActiveTime|date('r') }}">
|
2022-09-13 13:14:49 +00:00
|
|
|
<div class="settings__session__detail__title">
|
|
|
|
Last Active
|
|
|
|
</div>
|
2023-07-28 20:06:12 +00:00
|
|
|
<time class="settings__session__detail__value" datetime="{{ session.lastActiveTime|date('c') }}">
|
|
|
|
{{ session.lastActiveTime|time_format }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</time>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="settings__session__detail">
|
|
|
|
<div class="settings__session__detail__title">
|
|
|
|
User Agent
|
|
|
|
</div>
|
|
|
|
<div class="settings__session__detail__value">
|
2023-07-28 20:06:12 +00:00
|
|
|
{{ session.userAgentString }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro user_login_attempt(attempt) %}
|
|
|
|
<div class="settings__login-attempt{% if not attempt.success %} settings__login-attempt--failed{% endif %}">
|
|
|
|
<div class="settings__login-attempt__container">
|
|
|
|
<div class="settings__login-attempt__important">
|
2023-07-22 16:37:57 +00:00
|
|
|
<div class="flag flag--{{ attempt.countryCode|lower }} settings__login-attempt__flag" title="{{ attempt.countryCode|country_name }}">{{ attempt.countryCode }}</div>
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
<div class="settings__login-attempt__description">
|
2023-07-21 12:47:56 +00:00
|
|
|
{{ attempt.clientInfo }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__login-attempt__details">
|
|
|
|
<div class="settings__login-attempt__detail">
|
|
|
|
<div class="settings__login-attempt__detail__title">
|
|
|
|
IP Address
|
|
|
|
</div>
|
|
|
|
<div class="settings__login-attempt__detail__value">
|
2023-07-22 16:37:57 +00:00
|
|
|
{{ attempt.remoteAddressRaw }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__login-attempt__detail">
|
|
|
|
<div class="settings__login-attempt__detail__title">
|
|
|
|
Succeeded
|
|
|
|
</div>
|
|
|
|
<div class="settings__login-attempt__detail__value">
|
|
|
|
{{ attempt.success ? 'Yes' : 'No' }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__login-attempt__detail" title="{{ attempt.createdTime|date('r') }}">
|
|
|
|
<div class="settings__login-attempt__detail__title">
|
|
|
|
Attempted
|
|
|
|
</div>
|
|
|
|
<time class="settings__login-attempt__detail__value" datetime="{{ attempt.createdTime|date('c') }}">
|
2023-07-18 23:12:47 +00:00
|
|
|
{{ attempt.createdTime|time_format }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</time>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__login-attempt__detail">
|
|
|
|
<div class="settings__login-attempt__detail__title">
|
|
|
|
User Agent
|
|
|
|
</div>
|
|
|
|
<div class="settings__login-attempt__detail__value">
|
2023-07-22 16:37:57 +00:00
|
|
|
{{ attempt.userAgentString }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|
|
|
|
|
2023-08-02 22:12:47 +00:00
|
|
|
{% macro user_account_log(data, users, colours) %}
|
2022-09-13 13:14:49 +00:00
|
|
|
{% from 'macros.twig' import avatar %}
|
|
|
|
|
|
|
|
<div class="settings__account-log">
|
2023-07-17 17:43:17 +00:00
|
|
|
{% if data.hasUserId and users[data.userId] is defined %}
|
|
|
|
{% set user = users[data.userId] %}
|
2023-08-02 22:12:47 +00:00
|
|
|
{% set colour = colours[data.userId]|default(null) %}
|
|
|
|
<a href="{{ url('user-profile', {'user': user.id}) }}" class="settings__account-log__user"{% if colour is not null %} style="--user-colour: {{ colour }}"{% endif %}>
|
|
|
|
<div class="settings__account-log__user__avatar">{{ avatar(user.id, 20, user.name) }}</div>
|
|
|
|
<div class="settings__account-log__user__name">{{ user.name }}</div>
|
2022-09-13 13:14:49 +00:00
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<div class="settings__account-log__container">
|
|
|
|
<div class="settings__account-log__important">
|
2023-07-17 17:43:17 +00:00
|
|
|
<div class="flag flag--{{ data.countryCode|lower }} settings__login-attempt__flag" title="{{ data.countryCode|country_name }}">{{ data.countryCode }}</div>
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
<div class="settings__login-attempt__description">
|
2023-07-17 17:43:17 +00:00
|
|
|
{{ data.formatted }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__account-log__details">
|
|
|
|
<div class="settings__account-log__detail">
|
|
|
|
<div class="settings__account-log__detail__title">
|
|
|
|
IP Address
|
|
|
|
</div>
|
|
|
|
<div class="settings__account-log__detail__value">
|
|
|
|
{{ data.remoteAddress }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="settings__account-log__detail" title="{{ data.createdTime|date('r') }}">
|
|
|
|
<div class="settings__account-log__detail__title">
|
|
|
|
Date
|
|
|
|
</div>
|
|
|
|
<time class="settings__account-log__detail__value" datetime="{{ data.createdTime|date('c') }}">
|
2023-07-18 23:12:47 +00:00
|
|
|
{{ data.createdTime|time_format }}
|
2022-09-13 13:14:49 +00:00
|
|
|
</time>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endmacro %}
|