233 lines
14 KiB
PHTML
233 lines
14 KiB
PHTML
|
<?php
|
||
|
use Utopia\Locale\Locale;
|
||
|
|
||
|
?>
|
||
|
<div data-appwrite="users.get"
|
||
|
data-service="user"
|
||
|
data-event="load"
|
||
|
data-param-user-id="{{state.params.id}}"
|
||
|
data-success="render,trigger"
|
||
|
data-error="render"
|
||
|
data-success-rerender="user.update"
|
||
|
data-error-rerender=""
|
||
|
data-success-triggers="user.load">
|
||
|
|
||
|
<div class="cover">
|
||
|
<h1 class="zone xl margin-bottom-large">
|
||
|
<a data-ls-href="/console/users?project={{state.params.project}}" class="back text-size-small"><i class="icon-left-open"></i> <?php echo $this->escape(Locale::getText('console.users.title')); ?></a>
|
||
|
<br />
|
||
|
|
||
|
<span data-ls-echo="{{user.name}}"> </span>
|
||
|
</h1>
|
||
|
</div>
|
||
|
|
||
|
<div class="zone xl">
|
||
|
<ul class="phases clear" data-ui-phases data-selected="{{state.params.tab}}">
|
||
|
<li data-state="/console/users/view?id={{state.params.id}}&project={{state.params.project}}">
|
||
|
<h2>General</h2>
|
||
|
|
||
|
<div data-ls-if="'{{user.status}}' === '<?php echo \Auth\Auth::USER_STATUS_BLOCKED; ?>'" style="display: none" class="box padding-small danger margin-bottom-xxl">
|
||
|
This user account is blocked.
|
||
|
</div>
|
||
|
|
||
|
<div class="row responsive margin-top-xl">
|
||
|
<div class="col span-8">
|
||
|
<div class="box margin-bottom-large">
|
||
|
<div class="text-center">
|
||
|
<img src="" data-ui-gravatar="{{user.email}}" data-name="{{user.name}}" data-size="200" alt="User Avatar" class="avatar huge margin-top-negative-xxl" />
|
||
|
|
||
|
<div class="margin-top-small note" data-ls-echo="Member since {{user.registration|date-text}}"></div>
|
||
|
<div class="margin-top-small">
|
||
|
<span data-ls-if="'{{user.confirm}}' === 'true'" style="display: none;">
|
||
|
<span class="tag green">Verified</span>
|
||
|
</span>
|
||
|
<span data-ls-if="'{{user.confirm}}' !== 'true'" style="display: none;">
|
||
|
<span class="tag">Unverified</span>
|
||
|
</span>
|
||
|
</div>
|
||
|
<div class="margin-top-small" data-ls-echo="{{user.email}}"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<h3 class="margin-bottom">Preferences</h3>
|
||
|
|
||
|
<div class="box margin-bottom"
|
||
|
data-appwrite="users.getPrefs"
|
||
|
data-service="user-prefs"
|
||
|
data-event="load"
|
||
|
data-param-user-id="{{state.params.id}}"
|
||
|
data-success="render,trigger"
|
||
|
data-error="render"
|
||
|
data-success-rerender=""
|
||
|
data-error-rerender=""
|
||
|
data-success-triggers="user-prefs.load">
|
||
|
|
||
|
<div data-ls-if="'{{user-prefs}}' && '{}' !== '{{user-prefs}}'" style="display: none;">
|
||
|
<table class="vertical">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th>Key</th>
|
||
|
<th>Value</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody data-ls-loop="user-prefs" data-ls-as="pref">
|
||
|
<tr>
|
||
|
<td data-title="Key: ">
|
||
|
<span data-ls-echo="{{$index}}"></span>
|
||
|
</td>
|
||
|
<td data-title="Value: ">
|
||
|
<span data-ls-echo="{{pref}}"></span>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
|
||
|
<div data-ls-if="'{}' === '{{user-prefs}}'" style="display: none;">
|
||
|
No user preferences found
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col span-4">
|
||
|
<label>User ID</label>
|
||
|
<div class="input-copy margin-bottom-large">
|
||
|
<input id="uid" type="text" autocomplete="off" placeholder="" data-ls-echo="{{user.$uid}}" disabled data-forms-copy>
|
||
|
</div>
|
||
|
|
||
|
<div data-ls-if="'{{user.status}}' !== '<?php echo \Auth\Auth::USER_STATUS_BLOCKED; ?>'" style="display: none">
|
||
|
<form name="users.updateStatus" class="margin-bottom"
|
||
|
data-appwrite="users.updateStatus"
|
||
|
data-event="submit"
|
||
|
data-param-user-id="{{state.params.id}}"
|
||
|
data-success="alert,trigger"
|
||
|
data-success-alert="Blocked User Successfully"
|
||
|
data-success-triggers="user.update"
|
||
|
data-error="alert"
|
||
|
data-error-alert="Failed to Block User">
|
||
|
<button name="status" type="submit" class="danger fill" value="<?php echo \Auth\Auth::USER_STATUS_BLOCKED; ?>">Block Account</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
|
||
|
<div data-ls-if="'{{user.status}}' === '<?php echo \Auth\Auth::USER_STATUS_BLOCKED; ?>'" style="display: none">
|
||
|
<form name="users.updateStatus" class="margin-bottom"
|
||
|
data-appwrite="users.updateStatus"
|
||
|
data-event="submit"
|
||
|
data-param-user-id="{{state.params.id}}"
|
||
|
data-success="alert,trigger"
|
||
|
data-success-alert="Blocked Activated Successfully"
|
||
|
data-success-triggers="user.update"
|
||
|
data-error="alert"
|
||
|
data-error-alert="Failed to Activate User">
|
||
|
|
||
|
<button name="status" type="submit" class="fill" value="<?php echo \Auth\Auth::USER_STATUS_ACTIVATED; ?>">Activate Account</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</li>
|
||
|
<li data-state="/console/users/view/devices?id={{state.params.id}}&project={{state.params.project}}">
|
||
|
<h2>Devices</h2>
|
||
|
|
||
|
<div data-appwrite="users.getSessions"
|
||
|
data-service="sessions"
|
||
|
data-param-user-id="{{state.params.id}}"
|
||
|
data-event="load"
|
||
|
data-success="render"
|
||
|
data-error="render"
|
||
|
data-success-rerender="user.update">
|
||
|
|
||
|
<div data-ls-if="'{{sessions.length}}' === '0'" style="display: none" class="margin-top-xl margin-bottom-xl">
|
||
|
No sessions available
|
||
|
</div>
|
||
|
|
||
|
<div data-ls-if="'{{sessions.length}}' !== '0'" style="display: none">
|
||
|
<div class="box margin-bottom">
|
||
|
<ul data-ls-loop="sessions" data-ls-as="session" class="list">
|
||
|
<li class="clear">
|
||
|
<form class="pull-end"
|
||
|
data-appwrite="users.deleteSession"
|
||
|
data-event="submit"
|
||
|
data-loading="Loading..."
|
||
|
data-success="trigger"
|
||
|
data-success-triggers="user.update"
|
||
|
data-error="alert"
|
||
|
data-error-alert="Failed to logout session">
|
||
|
<input type="hidden" name="userId" data-ls-echo="{{state.params.id}}">
|
||
|
<input type="hidden" name="sessionId" data-ls-echo="{{session.id}}">
|
||
|
<button class="danger">Logout</button>
|
||
|
</form>
|
||
|
|
||
|
<img data-ls-src="{{env.API}}/v1/avatars/browsers/{{session.client.short_name|lowercase}}?width=120&height=120" data-ls-title="{{session.client.name}}" data-ls-alt="{{session.client.name}}" class="avatar trans pull-start margin-end" />
|
||
|
|
||
|
<span data-ls-echo="{{session.client.name}}"></span> <span data-ls-echo="{{session.client.version}}"></span> on <span data-ls-echo="{{session.model}}"></span> <span data-ls-echo="{{session.OS.name}}"></span> <span data-ls-echo="{{session.OS.version}}"></span>
|
||
|
|
||
|
<div class="note info margin-top-small">
|
||
|
<img data-ls-src="{{env.API}}/v1/avatars/flags/{{session.geo.isoCode}}?width=80&height=80" class="avatar xs margin-end-small inline" />
|
||
|
<small data-ls-echo="{{session.ip}}"></small> / <small data-ls-echo="{{session.geo.country}}"></small>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<form class="inline margin-bottom-large"
|
||
|
data-appwrite="users.deleteSessions"
|
||
|
data-param-user-id="{{state.params.id}}"
|
||
|
data-event="submit"
|
||
|
data-success="trigger"
|
||
|
data-success-triggers="user.update"
|
||
|
data-error="alert"
|
||
|
data-error-alert="Failed to logout all sessions">
|
||
|
<button class="danger">Logout from all devices</button>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</li>
|
||
|
<li data-state="/console/users/view/audit?id={{state.params.id}}&project={{state.params.project}}">
|
||
|
<h2>Audit Log</h2>
|
||
|
|
||
|
<div data-appwrite="users.getLogs"
|
||
|
data-service="logs"
|
||
|
data-param-user-id="{{state.params.id}}"
|
||
|
data-event="load"
|
||
|
data-success="render"
|
||
|
data-success-rerender="logs.load"
|
||
|
data-error="">
|
||
|
|
||
|
<div data-ls-if="'{{logs.length}}' === '0'" style="display: none" class="margin-top-xl margin-bottom-xl">
|
||
|
No logs available
|
||
|
</div>
|
||
|
|
||
|
<div class="box" data-ls-if="'{{logs.length}}' !== '0'" style="display: none">
|
||
|
<table class="vertical small">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<th width="140"><?php echo Locale::getText('console.account.section.security.recent-activity.date'); ?></th>
|
||
|
<th width="175"><?php echo Locale::getText('console.account.section.security.recent-activity.event'); ?></th>
|
||
|
<th><?php echo Locale::getText('console.account.section.security.recent-activity.client'); ?></th>
|
||
|
<th width="90"><?php echo Locale::getText('console.account.section.security.recent-activity.location'); ?></th>
|
||
|
<th width="90"><?php echo Locale::getText('console.account.section.security.recent-activity.ip'); ?></th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody data-ls-loop="logs" data-ls-as="log">
|
||
|
<tr>
|
||
|
<td data-title="<?php echo $this->escape(Locale::getText('console.account.section.security.recent-activity.date')); ?>: "><span data-ls-echo="{{log.time|date-time}}"></span></td>
|
||
|
<td data-title="<?php echo $this->escape(Locale::getText('console.account.section.security.recent-activity.event')); ?>: "><span data-ls-echo="{{log.event}}"></span></td>
|
||
|
<td data-title="<?php echo $this->escape(Locale::getText('console.account.section.security.recent-activity.client')); ?>: ">
|
||
|
<img data-ls-src="{{env.API}}/v1/avatars/browsers/{{log.client.short_name|lowercase}}?width=80&height=80" data-ls-title="{{log.client.name}}" data-ls-alt="{{log.client.name}}" class="avatar xs inline margin-end-small" />
|
||
|
<span data-ls-echo="{{log.client.name}} {{log.client.version}} on {{log.model}} {{log.OS.name}} {{log.OS.version}}"></span>
|
||
|
</td>
|
||
|
<td data-title="<?php echo $this->escape(Locale::getText('console.account.section.security.recent-activity.location')); ?>: ">
|
||
|
<img data-ls-src="{{env.API}}/v1/avatars/flags/{{log.geo.isoCode}}?width=80&height=80" class="avatar xs inline margin-end-small" />
|
||
|
<span data-ls-echo="{{log.geo.country}}"></span>
|
||
|
</td>
|
||
|
<td data-title="<?php echo $this->escape(Locale::getText('console.account.section.security.recent-activity.ip')); ?>: "><span data-ls-echo="{{log.ip}}"></span></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|