Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Translations for account pages
  • Loading branch information
NaysKutzu committed Sep 26, 2024
1 parent b5a1415 commit ec9920f
Show file tree
Hide file tree
Showing 8 changed files with 279 additions and 146 deletions.
122 changes: 122 additions & 0 deletions storage/lang/en_US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
# %seo_description% - The SEO description of the application
# %seo_keywords% - The SEO keywords of the application

# If you were asking what raw input means here is a simple explanation:
# Raw input means that the input is not processed by the framework. This means that the input is not escaped or sanitized.
# This is useful for passwords or other sensitive data that should not be processed by the framework.

# The language file is divided into sections. Each section has its own keys and values.
# You can use the keys in your views to display the values in the correct language.

Pages:
Components:
Sidebar:
Expand Down Expand Up @@ -91,7 +98,122 @@ Pages:
Title: "Invalid credentials"
Description: "The credentials you provided are invalid."
Button: "Go back home"
Account:
Components:
Navbar:
Settings: "Settings"
Security: "Security"
Mails: "Mails"
Activities: "Activities"
APIKeys: "API Keys"
Connections: "Connections"
Profile:
UUID: "UUID:"
Role: "Role:"
FirstIP: "First IP:"
Verified: "Verified:"
FirstSeen: "First seen:"
Security:
CurrentPassword:
Label: "Current password"
Placeholder: "············" # Raw input !!
NewPassword:
Label: "New password"
Placeholder: "············" # Raw input !!
ConfirmPassword:
Label: "Confirm password"
Placeholder: "············" # Raw input !!
PasswordRequirements:
Title: "Password requirements:"
Items:
Length: "At least 8 characters"
Uppercase: "At least one uppercase letter"
Lowercase: "At least one lowercase letter"
Number: "At least one number"
Special: "At least one special character"
SaveChanges: "Save changes"
Reset: "Reset"
TwoFactor:
Title: "Two Factor verification"
Enabled:
Title: "Two factor authentication is enabled."
Description: "Two-factor authentication adds an additional layer of security to your account by requiring more than just a password to log in."
LearnMore: "Learn more"
Button: "Enable two factor authentication"
Disabled:
Title: "Two factor authentication is not enabled yet."
Description: "Two-factor authentication adds an additional layer of security to your account by requiring more than just a password to log in."
LearnMore: "Learn more"
Button: "Disable two factor authentication"
Settings:
Form:
FirstName:
Label: "First name"
LastName:
Label: "Last name"
Email:
Label: "Email"
Avatar:
Label: "Avatar"
Background:
Label: "Background"
Submit: "Save changes"
Cancel: "Cancel"
DeactivateAccount:
Title: "Deactivate account"
Warning:
Title: "Are you sure you want to delete your account?"
Items:
First: "Once you delete your account, there is a 30 days window for you to contact support"
Secondary: "to recover your account. After 30 days, your account will be permanently disabled."
Third: "This means that you account will be marked as deleted BUT we reserve to keep all the data"
Fourth: "for legal reasons. You may open a ticket for your data to be anonymized due to GDPR!"
Confirm: "Yes, i want to delete my account and i agree with the terms of the account deletion policy."
Button: "Deactivate account"

Mails:
Table:
Head:
Columns:
ID: "ID"
Subject: "Subject"
From: "From"
Date: "Date"
Actions: "Actions"
Actions:
View: "View"
Delete: "Delete"
ApiKeys:
Create:
Title: "Create API Key"
Form:
Name:
Label: "Name the API key"
Placeholder: "Enter the name of the API key..."
Permissions:
Label: "Permissions"
Placeholder: "Select the permissions..."
Items:
ReadOnly: "Read Only"
ReadWrite: "Read & Write"
Unknown: "Unknown"
Submit:
Label: "Create new key"
List:
Title: "API Key List & Access"
Description: "An API key is a simple encrypted string that identifies an application without any principal. They are useful for accessing public data anonymously, and are used to associate API requests with your project for quota and billing."
Items:
Created: "Created on"
Deleted: "Delete"
Activities:
Table:
Head:
Columns:
ID: "ID"
Action: "Action"
Description: "Description"
IPAddress: "IP Address"
Date: "Date"
Auth:
Login:
Title: "Welcome back 👋!"
Expand Down
10 changes: 5 additions & 5 deletions storage/themes/v2/account/activities.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<table class="datatables-basic table">
<thead>
<tr>
<th>ID</th>
<th>Action</th>
<th>Description</th>
<th>Ip Address</th>
<th>Date</th>
<th>{{lang("Pages.Account.Activities.Table.Head.Columns.ID")}}</th>
<th>{{lang("Pages.Account.Activities.Table.Head.Columns.Action")}}</th>
<th>{{lang("Pages.Account.Activities.Table.Head.Columns.Description")}}</th>
<th>{{lang("Pages.Account.Activities.Table.Head.Columns.IPAddress")}}</th>
<th>{{lang("Pages.Account.Activities.Table.Head.Columns.Date")}}</th>
</tr>
</thead>
<tbody>
Expand Down
123 changes: 60 additions & 63 deletions storage/themes/v2/account/api.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,58 @@

<hr
class="my-0">
<!-- /Account -->

</div>
</div>
<div class="card mb-6">
<h5 class="card-header">Create an API key</h5>
<div class="row">
<div class="col-md-5 order-md-0 order-1">
<div class="card-body">
<form id="formAccountSettingsApiKey" method="POST">
<div class="row">
<div class="mb-5 col-12">
<label for="apiKey" class="form-label">Name the API key</label>
<input type="text" class="form-control" id="apiKey" name="apiKey" placeholder="Server Key 1"/>
</div>
<div class="mb-5 col-12">
<label for="apiAccess" class="form-label">Choose the Api key type you want to create</label>
<select id="apiAccess" name="apiAccess" class="select2 form-select form-select-lg">
<option value="">Choose Key Type</option>
<option value="rw">Read / Write</option>
<option value="r">Read Only</option>
</select>
</div>
{{ csrf_input | raw }}
<!-- Turnstile -->
{% if isTurnStileEnabled == true %}
<center>
<div class="cf-turnstile" data-sitekey="{{setting('cloudflare_turnstile', 'sitekey')}}"></div>
</center>
<br>
<br>
</br>
<br/>
{% else %}
<br>
{% endif %}
<div class="col-12">
<button type="submit" class="btn btn-primary me-2 d-grid w-100">Create Key</button>
<!-- /Account -->
<div class="row">
<h5 class="card-header text-left">&nbsp;&nbsp;&nbsp;{{lang("Pages.Account.ApiKeys.Create.Title")}}</h5>
<div class="col-md-5 order-md-0 order-1">
<div class="card-body">
<form id="formAccountSettingsApiKey" method="POST">
<div class="row">
<div class="mb-5 col-12">
<label for="apiKey" class="form-label">{{lang("Pages.Account.ApiKeys.Create.Form.Name.Label") }}</label>
<input type="text" class="form-control" id="apiKey" name="apiKey" placeholder="{{lang("Pages.Account.ApiKeys.Create.Form.Name.Placeholder") }}"/>
</div>
<div class="mb-5 col-12">
<label for="apiAccess" class="form-label">{{lang("Pages.Account.ApiKeys.Create.Form.Permissions.Label")}}</label>
<select id="apiAccess" name="apiAccess" class="select2 form-select form-select-lg">
<option value="">{{lang("Pages.Account.ApiKeys.Create.Form.Permissions.Placeholder")}}</option>
<option value="rw">{{lang("Pages.Account.ApiKeys.Create.Form.Permissions.Items.ReadWrite")}}</option>
<option value="r">{{lang("Pages.Account.ApiKeys.Create.Form.Permissions.Items.ReadOnly")}}</option>
</select>
</div>
{{ csrf_input | raw }}
<!-- Turnstile -->
{% if isTurnStileEnabled == true %}
<center>
<div class="cf-turnstile" data-sitekey="{{setting('cloudflare_turnstile', 'sitekey')}}"></div>
</center>
<br>
<br>
</br>
<br/>
{% else %}
<br>
{% endif %}
<div class="col-12">
<button type="submit" class="btn btn-primary me-2 d-grid w-100">{{lang("Pages.Account.ApiKeys.Create.Form.Submit.Label")}}</button>
</div>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
<div class="col-md-7 order-md-1 order-0">
<div class="text-center mt-4 mx-3 mx-md-0">
<img src="/assets/img/illustrations/girl-with-laptop.png" class="img-fluid" alt="Api Key Image" width="202"/>
<div class="col-md-7 order-md-1 order-0">
<div class="text-center mt-4 mx-3 mx-md-0">
<img src="/assets/img/illustrations/girl-with-laptop.png" class="img-fluid" alt="Api Key Image" width="202"/>
</div>
</div>
</div>
</div>
</div>
<div class="card mb-6">
<div class="card-body">
<h5>API Key List & Access</h5>
<h5>{{ lang('Pages.Account.ApiKeys.Create.List.Title') }}</h5>
<p class="mb-6">
An API key is a simple encrypted string that identifies an application without any principal. They are useful for accessing public data anonymously, and are used to associate API requests with your project for quota and billing.
{{lang("Pages.Account.ApiKeys.Create.List.Description") }}
</p>
<div class="row">
<div class="col-md-12">
Expand All @@ -79,11 +76,11 @@
({{api_key.id}})</h5>
<span class="badge bg-label-primary">
{% if api_key.type == 'rw' %}
Read & Write
{{ lang('Pages.Account.ApiKeys.Create.Form.Permissions.Items.ReadWrite') }}
{% elseif api_key.type == 'r' %}
Read
{{ lang('Pages.Account.ApiKeys.Create.Form.Permissions.Items.ReadOnly') }}
{% else %}
Unknown
{{ lang('Pages.Account.ApiKeys.Create.Form.Permissions.Items.Unknown') }}
{% endif %}
</span>
</div>
Expand All @@ -93,11 +90,11 @@
<i class="ti ti-copy"></i>
</span>
</div>
<span class="text-muted">Created on
<span class="text-muted">{{ lang('Pages.Account.ApiKeys.Create.List.Items.Created') }}
{{ api_key.date}}</span>
<div class="position-absolute top-50 end-0 translate-middle-y me-3">
<button class="btn btn-sm btn-danger" onclick="requireConfirmation('/account/api/{{ api_key.id }}/delete')">
Delete
{{ lang('Pages.Account.ApiKeys.Create.List.Items.Deleted') }}
</button>
</div>
</div>
Expand All @@ -114,18 +111,18 @@
{% endblock %}

{% block footer %}
{% include 'requirements/datatables.twig' %}
{% include 'requirements/datatables.twig' %}

<script>
document.getElementById('formAccountSettingsApiKey').addEventListener('submit', function(event) {
const apiKey = document.getElementById('apiKey').value;
const apiAccess = document.getElementById('apiAccess').value;
if (apiKey === '' || apiAccess === '') {
Swal.fire({icon: 'error',title: "{{ lang('Alerts.Error.PleaseFillAllFields.Title') }}",text: "{{ lang('Alerts.Error.PleaseFillAllFields.Message') }}"});
event.preventDefault();
return;
}
});
</script>
document.getElementById('formAccountSettingsApiKey').addEventListener('submit', function(event) {
const apiKey = document.getElementById('apiKey').value;
const apiAccess = document.getElementById('apiAccess').value;
if (apiKey === '' || apiAccess === '') {
Swal.fire({icon: 'error',title: "{{ lang('Alerts.Error.PleaseFillAllFields.Title') }}",text: "{{ lang('Alerts.Error.PleaseFillAllFields.Message') }}"});
event.preventDefault();
return;
}
});
</script>
{% endblock %}
12 changes: 6 additions & 6 deletions storage/themes/v2/account/components/navbar.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
<li class="nav-item">
<a class="nav-link {{ sidebar_account_settings is defined and sidebar_account_settings == 'active' ? 'active' : '' }} waves-effect waves-light" href="/account/settings">
<i class="ti-sm ti ti-users me-1_5"></i>
Settings</a>
{{ lang('Pages.Account.Components.Navbar.Settings') }}</a>
</li>
<li class="nav-item">
<a class="nav-link {{ sidebar_account_security is defined and sidebar_account_security == 'active' ? 'active' : '' }} waves-effect waves-light" href="/account/security">
<i class="ti-sm ti ti-lock me-1_5"></i>
Security</a>
{{ lang('Pages.Account.Components.Navbar.Security') }}</a>
</li>
{% if settings('smtp','enabled') == "true" %}
<li class="nav-item">
<a class="nav-link {{ sidebar_account_mails is defined and sidebar_account_mails == 'active' ? 'active' : '' }} waves-effect waves-light" href="/account/mails">
<i class="ti-sm ti ti-bookmark me-1_5"></i>
Mails
{{ lang('Pages.Account.Components.Navbar.Mails') }}
</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link {{ sidebar_account_activities is defined and sidebar_account_activities == 'active' ? 'active' : '' }} waves-effect waves-light" href="/account/activities">
<i class="ti-sm ti ti-bell me-1_5"></i>
Activities</a>
{{ lang('Pages.Account.Components.Navbar.Activities') }}</a>
</li>
<li class="nav-item">
<a class="nav-link {{ sidebar_account_api_key is defined and sidebar_account_api_key == 'active' ? 'active' : '' }} waves-effect waves-light" href="/account/api">
<i class="ti-sm ti ti-brand-stackshare me-1_5"></i>
API Keys</a>
{{ lang('Pages.Account.Components.Navbar.APIKeys') }}</a>
</li>
<li class="nav-item">
<a class="nav-link {{ sidebar_account_connections is defined and sidebar_account_connections == 'active' ? 'active' : '' }} waves-effect waves-light" href="/account/connections">
<i class="ti-sm ti ti-link me-1_5"></i>
Connections</a>
{{ lang('Pages.Account.Components.Navbar.Connections') }}</a>
</li>
</ul>
</div>
10 changes: 5 additions & 5 deletions storage/themes/v2/account/components/profile.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<div class="d-flex align-items-start align-items-sm-center gap-6">
<img src="{{ user('avatar',false) }}" alt="user-avatar" class="d-block w-px-100 h-px-100 rounded" id="uploadedAvatar">
<div class="button-wrapper">
<div>UUID:
<div>{{ lang('Pages.Account.Components.Profile.UUID') }}
<code>{{ user('uuid',false) }}</code>
</div>
<div>Role:
<div>{{ lang('Pages.Account.Components.Profile.Role') }}
<code>{{role_name}}</code>
</div>
<div>First IP:
<div>{{ lang('Pages.Account.Components.Profile.FirstIP') }}
<code>{{user('first_ip',true) }}</code>
/ (<code>{{user('last_ip',true) }}</code>)</div>
<div>Verified:
<div>{{ lang('Pages.Account.Components.Profile.Verified') }}
<code>{{user('verified',false) }}</code>
</div>
<div>First Seen:
<div>{{ lang('Pages.Account.Components.Profile.FirstSeen') }}
<code>{{user('first_seen',false) }}</code>
/ (<code>{{user('last_seen',false) }}</code>)</div>
</div>
Expand Down
Loading

0 comments on commit ec9920f

Please sign in to comment.