You've already forked isop-mirror
Merge branch 'develop' into feature/-81-Zmena-hesla-používateľa
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Mail\UserAccountActivated;
|
||||||
use App\Mail\UserPasswordReset;
|
use App\Mail\UserPasswordReset;
|
||||||
use App\Mail\UserRegistrationCompleted;
|
use App\Mail\UserRegistrationCompleted;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
@@ -25,6 +26,7 @@ class RegisteredUserController extends Controller
|
|||||||
public function store(Request $request): Response
|
public function store(Request $request): Response
|
||||||
{
|
{
|
||||||
$password = bin2hex(random_bytes(16));
|
$password = bin2hex(random_bytes(16));
|
||||||
|
$activation_token = bin2hex(random_bytes(16));
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:' . User::class],
|
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:' . User::class],
|
||||||
@@ -58,6 +60,7 @@ class RegisteredUserController extends Controller
|
|||||||
'phone' => $request->phone,
|
'phone' => $request->phone,
|
||||||
'role' => $request->role,
|
'role' => $request->role,
|
||||||
'password' => Hash::make($password),
|
'password' => Hash::make($password),
|
||||||
|
'activation_token' => $activation_token
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($user->role === "STUDENT") {
|
if ($user->role === "STUDENT") {
|
||||||
@@ -83,12 +86,33 @@ class RegisteredUserController extends Controller
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mail::to($user)->sendNow(new UserRegistrationCompleted($user->name, $password));
|
Mail::to($user)->sendNow(new UserRegistrationCompleted($user->name, $activation_token));
|
||||||
event(new Registered($user));
|
event(new Registered($user));
|
||||||
|
|
||||||
return response()->noContent();
|
return response()->noContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activate(Request $request) {
|
||||||
|
$request->validate([
|
||||||
|
'token' => ['required', 'string', 'exists:users,activation_token'],
|
||||||
|
'password' => ['required', 'string', 'min:8'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$user = User::where('activation_token', '=', $request->token)->first();
|
||||||
|
|
||||||
|
if (!$user) {
|
||||||
|
return response()->json(['message' => 'Invalid activation token'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->active = true;
|
||||||
|
$user->activation_token = null;
|
||||||
|
$user->password = Hash::make($request->password);
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
Mail::to($user)->sendNow(new UserAccountActivated($user->name));
|
||||||
|
return response()->noContent();
|
||||||
|
}
|
||||||
|
|
||||||
public function reset_password(Request $request): Response
|
public function reset_password(Request $request): Response
|
||||||
{
|
{
|
||||||
$request->validate([
|
$request->validate([
|
||||||
|
|||||||
@@ -49,6 +49,15 @@ class LoginRequest extends FormRequest
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the authenticated user's account is active
|
||||||
|
if (! Auth::user()->active) {
|
||||||
|
Auth::logout();
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => __('auth.inactive_account'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
RateLimiter::clear($this->throttleKey());
|
RateLimiter::clear($this->throttleKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
58
backend/app/Mail/UserAccountActivated.php
Normal file
58
backend/app/Mail/UserAccountActivated.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class UserAccountActivated extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
private string $name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct(string $name)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*/
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'User Account Activated',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*/
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'mail.activation.completed',
|
||||||
|
with: [
|
||||||
|
"name" => $this->name,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,15 +14,15 @@ class UserRegistrationCompleted extends Mailable
|
|||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
private string $name;
|
private string $name;
|
||||||
private string $password;
|
private string $activation_token;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct(string $name, string $password)
|
public function __construct(string $name, string $activation_token)
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->password = $password;
|
$this->activation_token = $activation_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,7 +44,7 @@ class UserRegistrationCompleted extends Mailable
|
|||||||
view: 'mail.registration.completed',
|
view: 'mail.registration.completed',
|
||||||
with: [
|
with: [
|
||||||
"name" => $this->name,
|
"name" => $this->name,
|
||||||
"password" => $this->password
|
"activation_token" => $this->activation_token
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ class User extends Authenticatable
|
|||||||
'email',
|
'email',
|
||||||
'role',
|
'role',
|
||||||
'password',
|
'password',
|
||||||
|
'active',
|
||||||
|
'needs_password_change',
|
||||||
|
'activation_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,6 +38,7 @@ class User extends Authenticatable
|
|||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'password',
|
'password',
|
||||||
'remember_token',
|
'remember_token',
|
||||||
|
'activation_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +51,8 @@ class User extends Authenticatable
|
|||||||
return [
|
return [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
'password' => 'hashed',
|
'password' => 'hashed',
|
||||||
|
'active' => 'boolean',
|
||||||
|
'needs_password_change' => 'boolean'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ class UserFactory extends Factory
|
|||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
'password' => static::$password ??= Hash::make('password'),
|
'password' => static::$password ??= Hash::make('password'),
|
||||||
'remember_token' => Str::random(10),
|
'remember_token' => Str::random(10),
|
||||||
|
'active' => true,
|
||||||
|
'needs_password_change' => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ return new class extends Migration
|
|||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
|
$table->boolean('active')->default(false);
|
||||||
|
$table->boolean('needs_password_change')->default(false);
|
||||||
|
$table->string('activation_token')->nullable();
|
||||||
$table->rememberToken();
|
$table->rememberToken();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@include("parts.header")
|
||||||
|
<p>Vážená/ý {{ $name }},</p>
|
||||||
|
<p>úspešne ste aktivovali váš účet!</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<p>s pozdravom</p>
|
||||||
|
<p>Systém ISOP UKF</p>
|
||||||
|
@include("parts.footer")
|
||||||
@@ -3,7 +3,12 @@
|
|||||||
<p>vaša registrácia do systému ISOP UKF prebehla úspešne!</p>
|
<p>vaša registrácia do systému ISOP UKF prebehla úspešne!</p>
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<p>Vaše heslo je: <em>{{ $password }}</em></p>
|
<p>Aktivujte účet pomocou nasledujúceho linku:</p>
|
||||||
|
<br />
|
||||||
|
<p>
|
||||||
|
<a
|
||||||
|
href="{{ config('app.frontend_url') }}/account/activation/{{ $activation_token }}">{{ config('app.frontend_url') }}/account/activation/{{ $activation_token }}</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ Route::middleware(['auth:sanctum'])->get('/user', function (Request $request) {
|
|||||||
return $user;
|
return $user;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::prefix('/account')->group(function () {
|
||||||
|
Route::post("/activate", [RegisteredUserController::class, 'activate']);
|
||||||
|
});
|
||||||
|
|
||||||
Route::middleware(['auth:sanctum'])->prefix('/students')->group(function () {
|
Route::middleware(['auth:sanctum'])->prefix('/students')->group(function () {
|
||||||
Route::post('/change-password', [RegisteredUserController::class, 'change_password']);
|
Route::post('/change-password', [RegisteredUserController::class, 'change_password']);
|
||||||
Route::get('/', [StudentDataController::class, 'all']);
|
Route::get('/', [StudentDataController::class, 'all']);
|
||||||
|
|||||||
138
frontend/app/pages/account/activation/[token].vue
Normal file
138
frontend/app/pages/account/activation/[token].vue
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { FetchError } from 'ofetch';
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
const client = useSanctumClient();
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: ['sanctum:guest'],
|
||||||
|
});
|
||||||
|
|
||||||
|
useSeoMeta({
|
||||||
|
title: "Aktivácia účtu | ISOP",
|
||||||
|
ogTitle: "Aktivácia účtu",
|
||||||
|
description: "Aktivácia účtu ISOP",
|
||||||
|
ogDescription: "Aktivácia účtu",
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
required: (v: string) => (!!v && v.trim().length > 0) || 'Povinné pole',
|
||||||
|
};
|
||||||
|
|
||||||
|
const isValid = ref(false);
|
||||||
|
const showPassword = ref(false);
|
||||||
|
const password = ref('');
|
||||||
|
|
||||||
|
const loading = ref(false);
|
||||||
|
const error = ref(null as null | string);
|
||||||
|
const success = ref(false);
|
||||||
|
|
||||||
|
async function handleLogin() {
|
||||||
|
error.value = null;
|
||||||
|
loading.value = true;
|
||||||
|
success.value = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await client('/api/account/activate', {
|
||||||
|
method: 'POST',
|
||||||
|
body: {
|
||||||
|
token: route.params.token,
|
||||||
|
password: password.value
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
success.value = true;
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof FetchError && e.response?.status === 422) {
|
||||||
|
error.value = e.response?._data.message;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<v-container fluid class="page-container form-wrap">
|
||||||
|
<v-card id="page-container-card">
|
||||||
|
<h2 class="page-title">Aktivácia účtu</h2>
|
||||||
|
|
||||||
|
<!-- Chybová hláška -->
|
||||||
|
<v-alert v-show="success" density="compact" title="Aktivácia ukončená" type="success" class="mx-auto alert">
|
||||||
|
<p>Váš účet bol úspešne aktivovaný! Prihláste sa <NuxtLink to="/login">tu</NuxtLink>.
|
||||||
|
</p>
|
||||||
|
</v-alert>
|
||||||
|
|
||||||
|
<div v-show="!success">
|
||||||
|
<!-- Chybová hláška -->
|
||||||
|
<v-alert v-if="error !== null" density="compact" :text="error" title="Chyba" type="error"
|
||||||
|
class="mx-auto alert"></v-alert>
|
||||||
|
|
||||||
|
<!-- Čakajúca hláška -->
|
||||||
|
<v-alert v-if="loading" density="compact" text="Prosím čakajte..." title="Spracovávam" type="info"
|
||||||
|
class="mx-auto alert"></v-alert>
|
||||||
|
|
||||||
|
<v-form v-else v-model="isValid" @submit.prevent="handleLogin">
|
||||||
|
<v-text-field v-model="password" :rules="[rules.required]"
|
||||||
|
:type="showPassword ? 'text' : 'password'" label="Heslo:" variant="outlined"
|
||||||
|
density="comfortable"
|
||||||
|
:append-inner-icon="showPassword ? 'mdi-eye-off-outline' : 'mdi-eye-outline'"
|
||||||
|
@click:append-inner="showPassword = !showPassword" />
|
||||||
|
|
||||||
|
<v-btn type="submit" color="success" size="large" block :disabled="!isValid">
|
||||||
|
Aktivovať
|
||||||
|
</v-btn>
|
||||||
|
</v-form>
|
||||||
|
</div>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.alert {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-container {
|
||||||
|
max-width: 1120px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding-left: 24px;
|
||||||
|
padding-right: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#page-container-card {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-wrap {
|
||||||
|
max-width: 640px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
font-size: 24px;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-weight: 700;
|
||||||
|
margin: 24px 0 16px;
|
||||||
|
color: #1f1f1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.forgot-btn {
|
||||||
|
text-transform: none;
|
||||||
|
font-weight: 600;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb-1 {
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mb-2 {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
118
frontend/app/pages/account/index.vue
Normal file
118
frontend/app/pages/account/index.vue
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { User } from '~/types/user';
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: ['sanctum:auth'],
|
||||||
|
});
|
||||||
|
|
||||||
|
useSeoMeta({
|
||||||
|
title: 'Môj profil | ISOP',
|
||||||
|
ogTitle: 'Môj profil',
|
||||||
|
description: 'Môj profil ISOP',
|
||||||
|
ogDescription: 'Môj profil ISOP',
|
||||||
|
});
|
||||||
|
|
||||||
|
const user = useSanctumUser<User>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<v-container fluid>
|
||||||
|
<v-card id="page-container-card">
|
||||||
|
<h1>Môj profil</h1>
|
||||||
|
|
||||||
|
<v-divider class="my-4" />
|
||||||
|
|
||||||
|
<!-- Osobné údaje -->
|
||||||
|
<h3>Osobné údaje</h3>
|
||||||
|
<v-list density="compact" class="readonly-list">
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Meno</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.first_name }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Priezvisko</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.last_name }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
|
||||||
|
<!-- Údaje študenta -->
|
||||||
|
<div v-if="user?.student_data">
|
||||||
|
<h3>Študentské údaje</h3>
|
||||||
|
<v-list density="compact" class="readonly-list">
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Osobný e-mail</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.student_data.personal_email }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Študijný odbor</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.student_data.study_field }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Adresa</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.student_data.address }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Údaje firmy -->
|
||||||
|
<div v-if="user?.company_data">
|
||||||
|
<h3>Firemné údaje</h3>
|
||||||
|
<v-list density="compact" class="readonly-list">
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Názov</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.company_data.name }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Adresa</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.company_data.address }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>IČO</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.company_data.ico }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-list density="compact" class="readonly-list">
|
||||||
|
<v-list-item>
|
||||||
|
<v-btn prepend-icon="mdi mdi-pencil" color="orange">
|
||||||
|
Zmeniť heslo
|
||||||
|
</v-btn>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
#page-container-card {
|
||||||
|
padding-left: 10px;
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-list {
|
||||||
|
--v-list-padding-start: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-list :deep(.v-list-item) {
|
||||||
|
--v-list-item-padding-start: 0px;
|
||||||
|
padding-left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-list :deep(.v-list-item__content) {
|
||||||
|
padding-left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-list :deep(.v-list-item-subtitle) {
|
||||||
|
white-space: pre-line;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-list :deep(.v-list-item-title) {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -32,6 +32,9 @@ const user = useSanctumUser<User>();
|
|||||||
<v-btn prepend-icon="mdi-account-hard-hat" color="blue" class="mr-2" to="/dashboard/admin/internships">
|
<v-btn prepend-icon="mdi-account-hard-hat" color="blue" class="mr-2" to="/dashboard/admin/internships">
|
||||||
Praxe
|
Praxe
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
<v-btn prepend-icon="mdi-pencil" color="orange" class="mr-2" to="/account">
|
||||||
|
Môj profil
|
||||||
|
</v-btn>
|
||||||
|
|
||||||
<!-- spacer -->
|
<!-- spacer -->
|
||||||
<div style="height: 40px;"></div>
|
<div style="height: 40px;"></div>
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ const user = useSanctumUser<User>();
|
|||||||
<!-- spacer -->
|
<!-- spacer -->
|
||||||
<div style="height: 40px;"></div>
|
<div style="height: 40px;"></div>
|
||||||
|
|
||||||
<v-btn prepend-icon="mdi-account-circle" color="blue" class="mr-2">
|
|
||||||
Môj profil
|
|
||||||
</v-btn>
|
|
||||||
<v-btn prepend-icon="mdi-briefcase" color="blue" class="mr-2" to="/dashboard/company/internships">
|
<v-btn prepend-icon="mdi-briefcase" color="blue" class="mr-2" to="/dashboard/company/internships">
|
||||||
Praxe
|
Praxe
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
<v-btn prepend-icon="mdi-account-circle" color="blue" class="mr-2" to="/account">
|
||||||
|
Môj profil
|
||||||
|
</v-btn>
|
||||||
|
|
||||||
<!-- spacer -->
|
<!-- spacer -->
|
||||||
<div style="height: 40px;"></div>
|
<div style="height: 40px;"></div>
|
||||||
|
|||||||
130
frontend/app/pages/dashboard/company/profile/index.vue
Normal file
130
frontend/app/pages/dashboard/company/profile/index.vue
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { User } from '~/types/user';
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
middleware: ['sanctum:auth', 'company-only'],
|
||||||
|
});
|
||||||
|
|
||||||
|
useSeoMeta({
|
||||||
|
title: 'Môj profil | ISOP',
|
||||||
|
ogTitle: 'Môj profil',
|
||||||
|
description: 'Profil firmy ISOP',
|
||||||
|
ogDescription: 'Profil firmy ISOP',
|
||||||
|
});
|
||||||
|
|
||||||
|
const user = useSanctumUser<User>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<v-container fluid class="page-container">
|
||||||
|
<v-card id="profile-card">
|
||||||
|
<template v-if="user">
|
||||||
|
<div class="header">
|
||||||
|
<v-avatar size="64" class="mr-4">
|
||||||
|
<v-icon size="48">mdi-account-circle</v-icon>
|
||||||
|
</v-avatar>
|
||||||
|
<div>
|
||||||
|
<h2 class="title">Môj profil</h2>
|
||||||
|
<p class="subtitle">{{ user?.company_data?.name || user?.name }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-divider class="my-4" />
|
||||||
|
|
||||||
|
<v-row>
|
||||||
|
<!-- Údaje firmy -->
|
||||||
|
<v-col cols="12" md="6">
|
||||||
|
<h3 class="section-title">Údaje firmy</h3>
|
||||||
|
<v-list density="compact" class="readonly-list">
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Názov</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.company_data?.name || '—' }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Adresa</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.company_data?.address || '—' }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>IČO</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.company_data?.ico ?? '—' }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-col>
|
||||||
|
|
||||||
|
<!-- Kontaktná osoba -->
|
||||||
|
<v-col cols="12" md="6">
|
||||||
|
<h3 class="section-title">Kontaktná osoba</h3>
|
||||||
|
<v-list density="compact" class="readonly-list">
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Meno</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.first_name || '—' }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Priezvisko</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.last_name || '—' }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Email</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.email || '—' }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-title>Telefón</v-list-item-title>
|
||||||
|
<v-list-item-subtitle>{{ user?.phone || '—' }}</v-list-item-subtitle>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
|
<v-list-item class="mt-4">
|
||||||
|
<v-btn prepend-icon="mdi mdi-pencil" color="blue" class="mr-2">
|
||||||
|
Zmeniť heslo
|
||||||
|
</v-btn>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<v-skeleton-loader
|
||||||
|
type="heading, text, text, divider, list-item-two-line, list-item-two-line, list-item-two-line"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</v-card>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
.page-container {
|
||||||
|
max-width: 1120px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding-left: 24px;
|
||||||
|
padding-right: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#profile-card { padding: 16px; }
|
||||||
|
.header { display: flex; align-items: center; }
|
||||||
|
.title { font-size: 24px; font-weight: 700; margin: 0; }
|
||||||
|
.subtitle { color: #555; margin-top: 4px; }
|
||||||
|
.section-title { font-size: 16px; font-weight: 700; margin: 8px 0 8px; }
|
||||||
|
|
||||||
|
.readonly-list {
|
||||||
|
--v-list-padding-start: 0px;
|
||||||
|
}
|
||||||
|
.readonly-list :deep(.v-list-item) {
|
||||||
|
--v-list-item-padding-start: 0px;
|
||||||
|
padding-left: 0 !important;
|
||||||
|
}
|
||||||
|
.readonly-list :deep(.v-list-item__content) {
|
||||||
|
padding-left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-list :deep(.v-list-item-subtitle) {
|
||||||
|
white-space: pre-line;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-list :deep(.v-list-item-title) { font-weight: 600; }
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user