Compare commits

..

5 Commits

20 changed files with 588 additions and 9 deletions

View File

@ -34,6 +34,7 @@ class Filters extends BaseFilters
'forcehttps' => ForceHTTPS::class, 'forcehttps' => ForceHTTPS::class,
'pagecache' => PageCache::class, 'pagecache' => PageCache::class,
'performance' => PerformanceMetrics::class, 'performance' => PerformanceMetrics::class,
'userSession' => \App\Filters\CheckUserSession::class,
]; ];
/** /**

View File

@ -12,3 +12,15 @@ $routes->get('car/(:any)', 'Cars::index/$1');
$routes->get('track/(:any)', 'Tracks::index/$1'); $routes->get('track/(:any)', 'Tracks::index/$1');
$routes->get('race/(:num)', 'Races::index/$1'); $routes->get('race/(:num)', 'Races::index/$1');
$routes->get('users', 'Users::index'); $routes->get('users', 'Users::index');
$routes->get('login', 'Users::login');
$routes->get('register', 'Register::index');
$routes->post('webserver', 'Webserver::index');
$routes->group('dashboard', static function ($routes) {
$routes->get('/', 'Dashboard::index', ['filter' => 'userSession']);
$routes->get('user', 'Dashboard::user', ['filter' => 'userSession']);
$routes->get('logout', 'Dashboard::logout');
$routes->post('login', 'Dashboard::login');
$routes->post('update_user', 'Dashboard::updateUser', ['filter' => 'userSession']);
$routes->post('change_passwd', 'Dashboard::changePasswd', ['filter' => 'userSession']);
});

View File

@ -10,6 +10,9 @@ class Dashboard extends BaseController
protected $usersModel; protected $usersModel;
use ResponseTrait; use ResponseTrait;
const HASH = PASSWORD_DEFAULT;
const COST = 16;
public function __construct() public function __construct()
{ {
$this->usersModel = new UsersModel(); $this->usersModel = new UsersModel();
@ -32,7 +35,7 @@ class Dashboard extends BaseController
//$tplData['users'] = $users; //$tplData['users'] = $users;
echo get_header('Dashboard', [], true); echo get_header('Dashboard', [], true);
echo view('dashboard/main.php', $tplData); echo view('dashboard/main.php', $tplData);
echo get_footer(); echo get_footer(['dashboard.js']);
} }
public function login() public function login()
@ -49,11 +52,89 @@ class Dashboard extends BaseController
echo get_header("My User", [], true); echo get_header("My User", [], true);
echo view('dashboard/user', ['user' => $user]); echo view('dashboard/user', ['user' => $user]);
echo get_footer(); echo get_footer(['dashboard.js']);
} }
public function users() { public function users() {
$users = $this->usersModel->findAll(); $users = $this->usersModel->findAll();
return $this->respond($users); return $this->respond($users);
} }
public function logout()
{
$this->session->destroy();
return redirect()->to('login');
}
public function updateUser()
{
$data = $this->request->getVar();
$response = [
'ok' => true,
'msg' => ''
];
$update = $this->usersModel->update($this->session->userid, $data);
if (!$update) $this->respond(['ok' => false, 'msg' => 'Error on update data']);
$file = $this->request->getFile('imginput');
if ($file && $file->getName())
{
// Verify is the file is correct and not, for example, a .exe renamed to .jpg
$ext = strtolower($file->guessExtension());
if ($ext != strtolower($file->getExtension())) $response['msg'] = 'The image is not valid';
else
{
// First, get the current avatar filnename, and delete if the extension is different
$userData = $this->usersModel->getUser($this->session->username);
$avatar = FCPATH . '/img/users/'. $userData->img;
$oldAvatarFile = new \CodeIgniter\Files\File($avatar);
if ($oldAvatarFile->getExtension() != $ext) unlink($avatar);
$filename = "{$this->session->username}.$ext";
$move = $file->move(FCPATH . '/img/users/', $filename, true);
if ($move) $update = $this->usersModel->update($this->session->userid, (object) ['img' => $filename]);
}
}
return $this->respond($response);
}
public function changePasswd()
{
$data = $this->request->getPost();
$response = [
'ok' => false,
'msg' => ''
];
if (!$data)
{
$response['msg'] = 'Not data send';
return $this->respond($response);
}
$query = $this->usersModel->select('password')->where('id', $this->session->userid)->get(1);
if (!$query) return $this->respond($response);
$user = $query->getRow();
if (!password_verify($data['cur_password'], $user->password))
{
$response['msg'] = 'The current password is not correct';
return $this->respond($response);
}
$password = password_hash($data['password'], self::HASH, [self::COST]);
$update = $this->usersModel->update($this->session->userid, (object) ['password' => $password]);
$response['ok'] = $update;
return $this->respond($response);
}
} }

View File

@ -0,0 +1,35 @@
<?php
namespace App\Filters;
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\IncomingRequest;
/**
* Este filtro sirve para comprobar si la sesión aun no se cerro por+
* exceder el limite de tiempo, para así evitar errores, sobre todo al guardar datos
*/
class CheckUserSession implements FilterInterface
{
public function before(RequestInterface $request, $arguments = null)
{
assert($request instanceof IncomingRequest);
$session = session();
if (!$session->has('userid'))
{
$session->destroy();
$response = service('response');
$response->setHeader('Location', base_url('login'));
$response->setStatusCode(302);
return $response->send();
}
}
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
{
// Do something here
}
}

View File

@ -5,7 +5,7 @@
<img id="img_404" src="<?= base_url('img/404.svg') ?>" /> <img id="img_404" src="<?= base_url('img/404.svg') ?>" />
<p id="text_404"> <p id="text_404">
<?php if (! empty($message) && $message !== '(null)') : ?> <?php if (!empty($message) && $message !== '(null)') : ?>
<?= nl2br(esc($message)) ?> <?= nl2br(esc($message)) ?>
<?php else : ?> <?php else : ?>
Sorry! Cannot seem to find the page you were looking for. Sorry! Cannot seem to find the page you were looking for.

View File

@ -0,0 +1,27 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?=$title?></title>
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>/css/microcss.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>/css/fontello-embedded.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>/css/sd-icons.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>/css/style.css" />
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>/css/dashboard.css" />
</head>
<body class="row">
<nav id="dashmenu" class="navbar navbar-vert col-2">
<a href="<?= base_url() ?>/dashboard/user"><i class="sd-account_box"></i>My User</a>
<!--a href="<?= base_url() ?>/dashboard/users"><i class="sd-groups"></i>Users</a-->
<a href="<?= base_url() ?>/dashboard/races"><i class="sd-sports"></i>Races</a>
<a href="<?= base_url() ?>/dashboard/logout"><i class="sd-logout"></i>Logout</a>
</nav>
<header>
<h3><?=$title?></h3>
</header>
<div id="dashboard" class="col-10">

View File

@ -0,0 +1 @@
<h1>Speed Dreams Dashboard</h1>

View File

@ -0,0 +1,288 @@
<h3>User data</h3>
<div id="user-edit-form">
<form method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-2">
<label>Username:</label>
</div>
<div class="col-6">
<input type="text" value="<?=$user->username?>" disabled />
</div>
</div>
<div class="row">
<div class="col-2">
<label>Email:</label>
</div>
<div class="col-6">
<input type="email" id="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" value="<?=$user->email?>" />
<span class="input-error">Email address isn't valid</span>
</div>
</div>
<div class="row">
<div class="col-2">
<label>Nation:</label>
</div>
<div class="col-6">
<select name="nation" id="flaginput" value="<?=$user->nation?>">
<option>Afghanistan</option>
<option>Albania</option>
<option>Algeria</option>
<option>American Samoa</option>
<option>Andorra</option>
<option>Angola</option>
<option>Anguilla</option>
<option>Antigua and Barbuda</option>
<option>Argentina</option>
<option>Armenia</option>
<option>Aruba</option>
<option>Australia</option>
<option>Austria</option>
<option>Azerbaijan</option>
<option>Bahamas</option>
<option>Bahrain</option>
<option>Bangladesh</option>
<option>Barbados</option>
<option>Belarus</option>
<option>Belgium</option>
<option>Belize</option>
<option>Benin</option>
<option>Bermuda</option>
<option>Bhutan</option>
<option>Bolivia</option>
<option>Bosnia</option>
<option>Botswana</option>
<option>Brazil</option>
<option>British Virgin Islands</option>
<option>Brunei</option>
<option>Bulgaria</option>
<option>Burkina Faso</option>
<option>Burundi</option>
<option>Cambodia</option>
<option>Cameroon</option>
<option>Canada</option>
<option>Cape Verde</option>
<option>Cayman Islands</option>
<option>Central African Republic</option>
<option>Chad</option>
<option>Chile</option>
<option>China</option>
<option>Christmas Island</option>
<option>Colombia</option>
<option>Comoros</option>
<option>Cook Islands</option>
<option>Costa Rica</option>
<option>Croatia</option>
<option>Cuba</option>
<option>Cyprus</option>
<option>Czech Republic</option>
<option>Côte d'Ivoire</option>
<option>Democratic Republic of the Congo</option>
<option>Denmark</option>
<option>Djibouti</option>
<option>Dominica</option>
<option>Dominican Republic</option>
<option>Ecuador</option>
<option>Egypt</option>
<option>El Salvador</option>
<option>Equatorial Guinea</option>
<option>Eritrea</option>
<option>Estonia</option>
<option>Ethiopia</option>
<option>Falkland Islands</option>
<option>Faroe Islands</option>
<option>Fiji</option>
<option>Finland</option>
<option>France</option>
<option>French Polynesia</option>
<option>Gabon</option>
<option>Gambia</option>
<option>Georgia</option>
<option>Germany</option>
<option>Ghana</option>
<option>Gibraltar</option>
<option>Greece</option>
<option>Greenland</option>
<option>Grenada</option>
<option>Guam</option>
<option>Guatemala</option>
<option>Guinea</option>
<option>Guinea Bissau</option>
<option>Guyana</option>
<option>Haiti</option>
<option>Honduras</option>
<option>Hong Kong</option>
<option>Hungary</option>
<option>Iceland</option>
<option>India</option>
<option>Indonesia</option>
<option>Iran</option>
<option>Iraq</option>
<option>Ireland</option>
<option>Israel</option>
<option>Italy</option>
<option>Jamaica</option>
<option>Japan</option>
<option>Jordan</option>
<option>Kazakhstan</option>
<option>Kenya</option>
<option>Kiribati</option>
<option>Kuwait</option>
<option>Kyrgyzstan</option>
<option>Laos</option>
<option>Latvia</option>
<option>Lebanon</option>
<option>Lesotho</option>
<option>Liberia</option>
<option>Libya</option>
<option>Liechtenstein</option>
<option>Lithuania</option>
<option>Luxembourg</option>
<option>Macao</option>
<option>Macedonia</option>
<option>Madagascar</option>
<option>Malawi</option>
<option>Malaysia</option>
<option>Maldives</option>
<option>Mali</option>
<option>Malta</option>
<option>Marshall Islands</option>
<option>Martinique</option>
<option>Mauritania</option>
<option>Mauritius</option>
<option>Mexico</option>
<option>Micronesia</option>
<option>Moldova</option>
<option>Monaco</option>
<option>Mongolia</option>
<option>Montserrat</option>
<option>Morocco</option>
<option>Mozambique</option>
<option>Myanmar</option>
<option>Namibia</option>
<option>Nauru</option>
<option>Nepal</option>
<option>Netherlands</option>
<option>Netherlands Antilles</option>
<option>New Zealand</option>
<option>Nicaragua</option>
<option>Niger</option>
<option>Nigeria</option>
<option>Niue</option>
<option>Norfolk Island</option>
<option>North Korea</option>
<option>Norway</option>
<option>Oman</option>
<option>Pakistan</option>
<option>Palau</option>
<option>Panama</option>
<option>Papua New Guinea</option>
<option>Paraguay</option>
<option>Peru</option>
<option>Philippines</option>
<option>Pitcairn Islands</option>
<option>Poland</option>
<option>Portugal</option>
<option>Puerto Rico</option>
<option>Qatar</option>
<option>Republic of the Congo</option>
<option>Romania</option>
<option>Russian Federation</option>
<option>Rwanda</option>
<option>Saint Kitts and Nevis</option>
<option>Saint Lucia</option>
<option>Saint Pierre</option>
<option>Saint Vicent and the Grenadines</option>
<option>Samoa</option>
<option>San Marino</option>
<option>Sao Tomé and Príncipe</option>
<option>Saudi Arabia</option>
<option>Senegal</option>
<option>Serbia and Montenegro</option>
<option>Seychelles</option>
<option>Sierra Leone</option>
<option>Singapore</option>
<option>Slovakia</option>
<option>Slovenia</option>
<option>Soloman Islands</option>
<option>Somalia</option>
<option>South Africa</option>
<option>South Georgia</option>
<option>South Korea</option>
<option>Soviet Union</option>
<option>Spain</option>
<option>Sri Lanka</option>
<option>Sudan</option>
<option>Suriname</option>
<option>Swaziland</option>
<option>Sweden</option>
<option>Switzerland</option>
<option>Syria</option>
<option>Taiwan</option>
<option>Tajikistan</option>
<option>Tanzania</option>
<option>Thailand</option>
<option>Tibet</option>
<option>Timor-Leste</option>
<option>Togo</option>
<option>Tonga</option>
<option>Trinidad and Tobago</option>
<option>Tunisia</option>
<option>Turkey</option>
<option>Turkmenistan</option>
<option>Turks and Caicos Islands</option>
<option>Tuvalu</option>
<option>UAE</option>
<option>Uganda</option>
<option>Ukraine</option>
<option>United Kingdom</option>
<option>United States of America</option>
<option>Uruguay</option>
<option>US Virgin Islands</option>
<option>Uzbekistan</option>
<option>Vanuatu</option>
<option>Vatican City</option>
<option>Venezuela</option>
<option>Vietnam</option>
<option>Wallis and Futuna</option>
<option>Yemen</option>
<option>Zambia</option>
<option>Zimbabwe</option>
</select>
</div>
</div>
<div class="row">
<div class="col-2">
<label>Profile image:</label>
</div>
<div class="col-6">
<input type="file" name="imginput" id="imginput" />
</div>
<div class="col-12">
<img src="<?= base_url() . "/img/users/{$user->img}" ?>" id="profile-img">
</div>
</div>
<div class="register-right">
<input type="submit" value="Register" class="primary" />
</div>
</form>
</div>
<h3>Password</h3>
<div id="user-passwd-form">
<form method="post" enctype="multipart/form-data" action="/dashboard/change_passwd">
<label>Current password:</label>
<input type="password" name="cur_password" id="cur_password" required />
<label>Password:</label>
<input type="password" name="password" id="password" required />
<label>Repeat password:</label>
<input type="password" name="passwordcheck" id="passwordcheck" required />
<span class="input-error" id="passwd-error">Passwords don't match</span>
<div class="register-right">
<input type="submit" value="Register" class="primary" />
</div>
</form>
</div>
<script>
const nation = '<?=$user->nation?>'
</script>

View File

@ -8,6 +8,6 @@
<button type="submit">Login</button> <button type="submit">Login</button>
</form> </form>
<div id="login-error" class="error"> <div id="login-error" class="error">
Usuario y/o contraseña incorrecto. User and/or passwd incorrect.
</div> </div>
</div> </div>

View File

@ -3,6 +3,7 @@
const base_url = '<?= base_url() ?>'; const base_url = '<?= base_url() ?>';
</script> </script>
<script type="text/javascript" src="<?=base_url()?>/js/pequejs.js"></script> <script type="text/javascript" src="<?=base_url()?>/js/pequejs.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/axios.min.js"></script>
<script type="text/javascript" src="<?=base_url()?>/js/app.js"></script> <script type="text/javascript" src="<?=base_url()?>/js/app.js"></script>
<?php if(!empty($custom_js)): ?> <?php if(!empty($custom_js)): ?>
<?php foreach ($custom_js as $js): ?> <?php foreach ($custom_js as $js): ?>

View File

@ -12,9 +12,10 @@
<body> <body>
<nav class="mainMenu"> <nav class="mainMenu">
<a href="<?= base_url() ?>">Home</a> <a href="<?= base_url() ?>">Home</a>
<a href="<?= base_url() ?>/users">Racers</a> <a href="<?= base_url('users') ?>">Racers</a>
<!--<li><a href="./live.php">Live stats</a></li>--> <!--<li><a href="./live.php">Live stats</a></li>-->
<a href="<?= base_url() ?>/register">Register</a> <a href="<?= base_url('register') ?>">Register</a>
<a href="<?= base_url('login') ?>">Login</a>
<a href="https://speed-dreams.net" target="_black">Blog</a> <a href="https://speed-dreams.net" target="_black">Blog</a>
</nav> </nav>

View File

@ -20,13 +20,30 @@ a.selected {
#dashmenu, #dashmenu,
header { header {
margin-top: 1rem; padding-top: 1rem;
} }
/* Menu */ /* Menu */
#dashmenu {
display: flex;
flex-direction: column;
height: 100vh;
}
#dashmenu a { #dashmenu a {
text-decoration: none; text-decoration: none;
padding: 8px;
transition: none;
}
#dashmenu a:hover {
background-color: #4a4a4a;
color: #eee;
}
#dashmenu a > i {
margin-right: 8px;
} }
/* Edit user */ /* Edit user */

BIN
public/css/fonts/sd.eot Normal file

Binary file not shown.

18
public/css/fonts/sd.svg Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="sd" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe900;" glyph-name="git" d="M1004.629 493.653l-447.104 447.061c-25.771 25.728-67.499 25.728-93.355 0l-92.629-92.8 117.76-117.76c27.52 9.173 58.837 2.987 80.597-18.816 22.016-21.973 28.075-53.675 18.688-81.067l113.408-113.493c27.52 9.515 59.179 3.328 81.067-18.56 30.763-30.72 30.763-80.384 0-111.104-30.677-30.677-80.256-30.677-110.933 0-22.997 23.083-28.757 57.045-17.237 85.163l-106.197 105.643v-278.4c7.509-3.669 14.592-8.661 20.821-14.848 30.421-30.763 30.421-80.341 0-110.933-30.677-30.763-80.597-30.763-111.317 0-30.677 30.677-30.677 80.171 0 110.848 7.765 7.68 16.512 13.483 25.813 17.323v281.131c-9.259 3.883-18.091 9.472-25.6 17.109-23.253 23.253-28.843 57.259-16.896 85.717l-115.712 116.267-306.603-306.389c-25.6-25.813-25.6-67.584 0-93.397l447.147-447.019c25.771-25.771 67.499-25.771 93.269 0l445.013 445.013c25.813 25.728 25.813 67.499 0 93.312z" />
<glyph unicode="&#xe901;" glyph-name="mastodon" d="M989.568 623.829c0 222.123-145.536 287.232-145.536 287.232-73.387 33.707-199.424 47.872-330.283 48.939h-3.243c-130.901-1.067-256.853-15.232-330.24-48.939 0 0-145.536-65.109-145.536-287.232 0-50.859-0.981-111.701 0.64-176.171 5.291-217.259 39.851-431.317 240.683-484.48 92.587-24.491 172.117-29.653 236.16-26.112 116.139 6.4 181.333 41.472 181.333 41.472l-3.84 84.267c0 0-82.987-26.155-176.171-22.997-92.373 3.157-189.824 9.941-204.757 123.349-1.305 9.295-2.050 20.032-2.050 30.944 0 0.296 0.001 0.592 0.002 0.889v-0.046c0 0 90.667-22.187 205.525-27.435 70.229-3.2 136.107 4.139 203.008 12.075 128.299 15.317 240 94.379 254.037 166.613 22.059 113.707 20.267 277.632 20.267 277.632zM817.877 337.579h-106.539v261.077c0 55.040-23.168 82.944-69.461 82.944-51.2 0-76.885-33.109-76.885-98.645v-142.891h-105.941v142.933c0 65.536-25.685 98.645-76.885 98.645-46.293 0-69.461-27.947-69.461-82.944v-261.077h-106.539v268.928c0 54.997 13.995 98.688 42.112 130.987 29.013 32.341 66.944 48.896 114.091 48.896 54.528 0 95.829-20.949 123.136-62.891l26.496-44.501 26.539 44.501c27.307 41.941 68.608 62.891 123.136 62.891 47.104 0 85.077-16.555 114.091-48.896 28.075-32.299 42.069-75.989 42.069-130.987z" />
<glyph unicode="&#xe902;" glyph-name="peertube" d="M128 960v-512l384 256zM128 448v-512l384 256zM512 704v-512l384 256z" />
<glyph unicode="&#xe903;" glyph-name="youtube" d="M1002.453 695.253c-12.365 43.307-45.781 76.722-88.183 88.866l-0.905 0.222c-79.787 21.376-400.896 21.376-400.896 21.376s-320.299 0.427-400.896-21.376c-43.307-12.365-76.722-45.781-88.866-88.183l-0.222-0.905c-14.173-72.978-22.281-156.904-22.281-242.723 0-1.743 0.003-3.484 0.010-5.225l-0.001 0.268c-0.004-1.198-0.006-2.617-0.006-4.035 0-85.813 8.107-169.732 23.598-251.033l-1.32 8.327c12.365-43.307 45.781-76.722 88.183-88.866l0.905-0.222c79.701-21.419 400.896-21.419 400.896-21.419s320.256 0 400.896 21.419c43.307 12.365 76.722 45.781 88.866 88.183l0.222 0.905c13.59 71.472 21.364 153.686 21.364 237.715 0 3.173-0.011 6.344-0.033 9.513l0.003-0.486c0.024 2.951 0.037 6.439 0.037 9.929 0 84.041-7.776 166.267-22.648 245.996l1.278-8.245zM409.984 294.357v306.901l267.264-153.685z" />
<glyph unicode="&#xe904;" glyph-name="sports_score_24dp_E8EAED_FILL0_wght400_GRAD0_opsz24" d="M384 704h85.333v85.333h-85.333v-85.333zM554.667 704v85.333h85.333v-85.333h-85.333zM384 362.667v85.333h85.333v-85.333h-85.333zM725.333 533.333v85.333h85.333v-85.333h-85.333zM725.333 362.667v85.333h85.333v-85.333h-85.333zM554.667 362.667v85.333h85.333v-85.333h-85.333zM725.333 704v85.333h85.333v-85.333h-85.333zM469.333 618.667v85.333h85.333v-85.333h-85.333zM213.333 106.667v682.667h85.333v-85.333h85.333v-85.333h-85.333v-85.333h85.333v-85.333h-85.333v-341.333h-85.333zM640 448v85.333h85.333v-85.333h-85.333zM469.333 448v85.333h85.333v-85.333h-85.333zM384 533.333v85.333h85.333v-85.333h-85.333zM554.667 533.333v85.333h85.333v-85.333h-85.333zM640 618.667v85.333h85.333v-85.333h-85.333z" />
<glyph unicode="&#xe905;" glyph-name="logout_24dp_E8EAED_FILL0_wght400_GRAD0_opsz24" d="M213.333 64q-35.2 0-60.267 25.067t-25.067 60.267v597.333q0 35.2 25.067 60.267t60.267 25.067h298.667v-85.333h-298.667v-597.333h298.667v-85.333h-298.667zM682.667 234.667l-58.667 61.867 108.8 108.8h-348.8v85.333h348.8l-108.8 108.8 58.667 61.867 213.333-213.333-213.333-213.333z" />
<glyph unicode="&#xe906;" glyph-name="groups_24dp_E8EAED_FILL0_wght400_GRAD0_opsz24" d="M0 192v67.2q0 45.867 46.933 74.667t123.733 28.8q13.867 0 26.667-0.533t24.533-2.667q-14.933-22.4-22.4-46.933t-7.467-51.2v-69.333h-192zM256 192v69.333q0 34.133 18.667 62.4t52.8 49.6 81.6 32 102.933 10.667q56.533 0 104-10.667t81.6-32 52.267-49.6 18.133-62.4v-69.333h-512zM832 192v69.333q0 27.733-6.933 52.267t-20.8 45.867q11.733 2.133 24 2.667t25.067 0.533q76.8 0 123.733-28.267t46.933-75.2v-67.2h-192zM346.667 277.333h331.733q-10.667 21.333-59.2 37.333t-107.2 16-107.2-16-58.133-37.333zM170.667 405.333q-35.2 0-60.267 25.067t-25.067 60.267q0 36.267 25.067 60.8t60.267 24.533q36.267 0 60.8-24.533t24.533-60.8q0-35.2-24.533-60.267t-60.8-25.067zM853.333 405.333q-35.2 0-60.267 25.067t-25.067 60.267q0 36.267 25.067 60.8t60.267 24.533q36.267 0 60.8-24.533t24.533-60.8q0-35.2-24.533-60.267t-60.8-25.067zM512 448q-53.333 0-90.667 37.333t-37.333 90.667q0 54.4 37.333 91.2t90.667 36.8q54.4 0 91.2-36.8t36.8-91.2q0-53.333-36.8-90.667t-91.2-37.333zM512 533.333q18.133 0 30.4 12.267t12.267 30.4-12.267 30.4-30.4 12.267-30.4-12.267-12.267-30.4 12.267-30.4 30.4-12.267z" />
<glyph unicode="&#xe907;" glyph-name="account_box_24dp_E8EAED_FILL0_wght400_GRAD0_opsz24" d="M213.333 198.4q57.6 56.533 133.867 89.067t164.8 32.533 164.8-32.533 133.867-89.067v548.267h-597.333v-548.267zM512 405.333q61.867 0 105.6 43.733t43.733 105.6-43.733 105.6-105.6 43.733-105.6-43.733-43.733-105.6 43.733-105.6 105.6-43.733zM213.333 64q-35.2 0-60.267 25.067t-25.067 60.267v597.333q0 35.2 25.067 60.267t60.267 25.067h597.333q35.2 0 60.267-25.067t25.067-60.267v-597.333q0-35.2-25.067-60.267t-60.267-25.067h-597.333zM286.933 149.333h450.133q-46.933 41.6-106.133 63.467t-118.933 21.867-120-21.867-105.067-63.467zM512 490.667q-26.667 0-45.333 18.667t-18.667 45.333 18.667 45.333 45.333 18.667 45.333-18.667 18.667-45.333-18.667-45.333-45.333-18.667z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
public/css/fonts/sd.ttf Normal file

Binary file not shown.

BIN
public/css/fonts/sd.woff Normal file

Binary file not shown.

55
public/css/sd-icons.css Normal file
View File

@ -0,0 +1,55 @@
@font-face {
font-family: 'sd';
src: url('fonts/sd.eot?xx4vmn');
src: url('fonts/sd.eot?xx4vmn#iefix') format('embedded-opentype'),
url('fonts/sd.ttf?xx4vmn') format('truetype'),
url('fonts/sd.woff?xx4vmn') format('woff'),
url('fonts/sd.svg?xx4vmn#sd') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^="sd-"], [class*=" sd-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'sd' !important;
speak: never;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.sd-git:before {
content: "\e900";
color: #f05032;
}
.sd-mastodon:before {
content: "\e901";
color: #3088d4;
}
.sd-peertube:before {
content: "\e902";
color: #f1680d;
}
.sd-youtube:before {
content: "\e903";
color: #f00;
}
.sd-sports:before {
content: "\e904";
}
.sd-logout:before {
content: "\e905";
}
.sd-groups:before {
content: "\e906";
}
.sd-account_box:before {
content: "\e907";
}

View File

@ -589,6 +589,7 @@ sd-carcategoryselection {
max-width: 380px; max-width: 380px;
margin: auto; margin: auto;
text-align: center; text-align: center;
display: none;
} }
#login-error::before { #login-error::before {

2
public/js/axios.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -15,3 +15,42 @@ $('#login-form').on('submit', function(e) {
} }
}); });
}); });
$('#user-edit-form > form').on('submit', function(e) {
e.preventDefault()
const formData = new FormData(this);
axios.post(`${base_url}/dashboard/update_user`, formData)
.then( resp => {
if (resp.data) window.location.reload()
})
})
if (typeof nation !== 'undefined') {
$('#flaginput > option').each( ele => {
if (ele.innerText == nation) {
$(ele).attr('selected', true)
return true
}
})
}
$('#user-passwd-form > form').on('submit', function(e) {
e.preventDefault()
$('#passwd-error').hide();
const formData = new FormData(this);
if (formData.get('password') != formData.get('passwordcheck')) {
$('#passwd-error').show();
return;
}
axios.post(`${base_url}/dashboard/change_passwd`, formData)
.then( resp => {
if (resp.data) {
if (resp.data.ok) window.location.reload()
else alert(resp.data.msg)
}
})
})