changing fortify routes to work better with email and adding excel template for future implementation of equipment in DB.
This commit is contained in:
parent
ef5536a0d3
commit
44e0a3f373
62
app/Http/Controllers/CustomRegistrationController.php
Normal file
62
app/Http/Controllers/CustomRegistrationController.php
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
use App\Actions\Fortify\CreateNewUser;
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Redirect;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Models\pending_user;
|
||||||
|
|
||||||
|
use App\Mail\NewUserNotification;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
|
|
||||||
|
class CustomRegistrationController extends Controller
|
||||||
|
{
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$user = app(CreateNewUser::class)->create($request->all());
|
||||||
|
|
||||||
|
event(new Registered($user));
|
||||||
|
// Chame sendEmailVerificationNotification para enviar o e-mail de verificação
|
||||||
|
$user->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
// // Auth::login($user);
|
||||||
|
|
||||||
|
$pendingUser = pending_user::where('pending_email', $user->email)->first();
|
||||||
|
if ($pendingUser) {
|
||||||
|
$pendingUser->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $request->wantsJson()
|
||||||
|
? new JsonResponse([], 201)
|
||||||
|
: Redirect::to('/CreateUsers')->with('success', 'Usuário criado com sucesso, aguarda confirmacao por Email!!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function yourVerificationMethod(Request $request, $id, $hash)
|
||||||
|
{
|
||||||
|
$user = User::findOrFail($id);
|
||||||
|
|
||||||
|
if (!hash_equals((string) $hash, sha1($user->getEmailForVerification()))) {
|
||||||
|
abort(403, 'Unauthorized action.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->markEmailAsVerified()) {
|
||||||
|
event(new Verified($user));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirecione para a rota desejada após a verificação bem-sucedida
|
||||||
|
return redirect()->route('CreateUsers')->with('message', 'E-mail verificado com sucesso!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,11 @@
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
|
use App\Mail\NewUserNotification;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
|
||||||
use App\Models\pending_user;
|
use App\Models\pending_user;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
class Pending_UserController extends Controller
|
class Pending_UserController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -28,7 +32,7 @@ public function store(Request $request)
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'lastName' => 'required',
|
'lastName' => 'required',
|
||||||
'pending_email' => 'required|email|unique:pending_users,pending_email',
|
'pending_email' => 'required|email|unique:pending_users,pending_email|unique:users,email',
|
||||||
'pending_phone' => 'required',
|
'pending_phone' => 'required',
|
||||||
'pending_nif' => 'required',
|
'pending_nif' => 'required',
|
||||||
'pending_password' => 'required|min:8|confirmed',
|
'pending_password' => 'required|min:8|confirmed',
|
||||||
|
|
@ -46,6 +50,14 @@ public function store(Request $request)
|
||||||
|
|
||||||
$pendingUser->save();
|
$pendingUser->save();
|
||||||
|
|
||||||
|
// Enviar email de notificação para todos os Super_Administrador
|
||||||
|
$superAdmins = User::where('user_type', 'Super_Administrador')->get();
|
||||||
|
$newUserNotification = new NewUserNotification();
|
||||||
|
|
||||||
|
foreach ($superAdmins as $superAdmin) {
|
||||||
|
Mail::to($superAdmin->email)->send($newUserNotification);
|
||||||
|
}
|
||||||
|
|
||||||
return redirect('/formulario')->with('success', 'O seu registro foi enviado e aguarda aprovação.');
|
return redirect('/formulario')->with('success', 'O seu registro foi enviado e aguarda aprovação.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,9 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
@ -11,17 +14,33 @@
|
||||||
use Laravel\Fortify\Fortify;
|
use Laravel\Fortify\Fortify;
|
||||||
use Laravel\Fortify\Http\Controllers\AuthenticatedSessionController as FortifyAuthenticatedSessionController;
|
use Laravel\Fortify\Http\Controllers\AuthenticatedSessionController as FortifyAuthenticatedSessionController;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
class userController extends Controller
|
class userController extends Controller
|
||||||
{
|
{
|
||||||
public function UserProfile (){
|
public function UserProfile($id)
|
||||||
return view('Admin.profile');
|
{
|
||||||
|
$user = User::find($id);
|
||||||
|
return view('Admin.profile', compact('user'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function yourVerificationMethod(Request $request, $id, $hash)
|
||||||
|
{
|
||||||
|
$user = User::findOrFail($id);
|
||||||
|
|
||||||
|
if (!hash_equals((string) $hash, sha1($user->getEmailForVerification()))) {
|
||||||
|
abort(403, 'Unauthorized action.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->markEmailAsVerified()) {
|
||||||
|
event(new Verified($user));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Redirecione para a rota desejada após a verificação bem-sucedida
|
||||||
|
return redirect()->route('CreateUsers')->with('message', 'E-mail verificado com sucesso!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function authenticate(Request $request)
|
public function authenticate(Request $request)
|
||||||
|
|
@ -40,6 +59,19 @@ public function authenticate(Request $request)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function authenticateAndRedirect(Request $request)
|
||||||
|
{
|
||||||
|
$user = User::where('email', $request->email)->first();
|
||||||
|
|
||||||
|
if ($user && Hash::check($request->password, $user->password)) {
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
|
return redirect()->route('CreateUsers');
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function ListUsers()
|
public function ListUsers()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class CheckSuperAdmin
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
if (auth()->user() && auth()->user()->user_type == 'Super_Administrador') {
|
if (auth()->user() && auth()->user()->userType->type == 'Super_Administrador') {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
59
app/Mail/NewUserNotification.php
Normal file
59
app/Mail/NewUserNotification.php
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?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 NewUserNotification extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
return $this->subject('Um novo usuário para criar')
|
||||||
|
->view('emails.new_user_notification');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*/
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'New User Notification',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*/
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'email.new_user_notification',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
16
app/Models/TypeUser.php
Normal file
16
app/Models/TypeUser.php
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class TypeUser extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public function users()
|
||||||
|
{
|
||||||
|
return $this->hasMany(User::class, 'user_type', 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,10 +9,11 @@
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
|
||||||
|
|
||||||
class User extends Authenticatable implements MustVerifyEmail
|
class User extends Authenticatable
|
||||||
|
// implements MustVerifyEmail
|
||||||
{
|
{
|
||||||
use HasApiTokens, HasFactory, Notifiable;
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
|
|
@ -28,7 +29,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
'user_type',
|
'user_type',
|
||||||
'user_phone',
|
'user_phone',
|
||||||
'user_nif'
|
'user_nif'
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -49,4 +50,9 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function userType()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(TypeUser::class, 'user_type', 'id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||||
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
||||||
|
|
||||||
|
// use App\http\Controllers\userController;
|
||||||
|
|
||||||
|
|
||||||
use Laravel\Fortify\Fortify;
|
use Laravel\Fortify\Fortify;
|
||||||
|
|
||||||
|
|
@ -49,7 +51,12 @@ public function boot(): void
|
||||||
return view('auth.verify-email');
|
return view('auth.verify-email');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Fortify::authenticateUsing(function (Request $request) {
|
||||||
|
// return UserController::authenticateAndRedirect($request);
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Fortify::createUsersUsing(CreateNewUser::class);
|
Fortify::createUsersUsing(CreateNewUser::class);
|
||||||
|
|
||||||
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
|
Fortify::updateUserProfileInformationUsing(UpdateUserProfileInformation::class);
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@
|
||||||
'features' => [
|
'features' => [
|
||||||
Features::registration(),
|
Features::registration(),
|
||||||
Features::resetPasswords(),
|
Features::resetPasswords(),
|
||||||
Features::emailVerification(),
|
// Features::emailVerification(),
|
||||||
|
|
||||||
// Features::updateProfileInformation(),
|
// Features::updateProfileInformation(),
|
||||||
// Features::updatePasswords(),
|
// Features::updatePasswords(),
|
||||||
|
|
|
||||||
BIN
public/templateExcel/FinalTemplate .xlsx
Normal file
BIN
public/templateExcel/FinalTemplate .xlsx
Normal file
Binary file not shown.
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
</div> --}}
|
</div> --}}
|
||||||
|
|
||||||
|
<br><br>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8 col-md-offset-2">
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,14 @@
|
||||||
<th>Tipo de usuário</th>
|
<th>Tipo de usuário</th>
|
||||||
<td>{{ $user->user_type }}</td>
|
<td>{{ $user->user_type }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Telemovel</th>
|
||||||
|
<td>{{ $user->user_phone }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>NIF</th>
|
||||||
|
<td>{{ $user->user_nif }}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Criado em : </th>
|
<th>Criado em : </th>
|
||||||
<td>{{ $user->created_at }}</td>
|
<td>{{ $user->created_at }}</td>
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
@extends('Templates/templateAdmin')
|
@extends('Templates/templateAdmin')
|
||||||
|
|
||||||
@section('Main-content')
|
@section('Main-content')
|
||||||
|
<section class="content">
|
||||||
<section class="content">
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<!-- Card box User Profile -->
|
<!-- Card box User Profile -->
|
||||||
<div class="card card-primary">
|
<br><br>
|
||||||
|
<div class="card card-primary">
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
<div class="col-sm">
|
<div class="col-sm">
|
||||||
<div class="user-panel mt-3 pb-3 mb-3">
|
<div class="user-panel mt-3 pb-3 mb-3">
|
||||||
|
|
||||||
<div class="image d-flex justify-content-center align-items-center">
|
<div class="image d-flex justify-content-center align-items-center">
|
||||||
|
|
||||||
<label for="input-file" class="imgProfile-hover">
|
<label for="input-file" class="imgProfile-hover">
|
||||||
<img src="{{ asset('/img/avatar5.png') }}"
|
<img src="{{ asset('/img/avatar5.png') }}"
|
||||||
class="img-circle elevation-2 imgProfile" alt="User Image">
|
class="img-circle elevation-2 imgProfile" alt="User Image">
|
||||||
|
|
||||||
{{-- Parte de baixo para colocar o 'Escolher arquivo' --}}
|
{{-- Parte de baixo para colocar o 'Escolher arquivo' --}}
|
||||||
{{-- <div class="input-group input-file">
|
{{-- <div class="input-group input-file">
|
||||||
<input type="text" class="form-control"
|
<input type="text" class="form-control"
|
||||||
placeholder="Escolha um arquivo" readonly>
|
placeholder="Escolha um arquivo" readonly>
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
|
|
@ -30,71 +30,84 @@ class="img-circle elevation-2 imgProfile" alt="User Image">
|
||||||
type="button">Escolher arquivo</button>
|
type="button">Escolher arquivo</button>
|
||||||
</span>
|
</span>
|
||||||
</div> --}}
|
</div> --}}
|
||||||
|
</label>
|
||||||
</label>
|
{{-- <input type="file" id="input-file" class="d-none"> --}}
|
||||||
{{-- <input type="file" id="input-file" class="d-none"> --}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="info text-center">
|
<div class="text-center">
|
||||||
{{-- <p class="d-block" style="font-size: 2rem;">{{ $tipo_usuario }}</p> --}}
|
<h5>{{$user->userType->type }} :: {{$user->name}} </h5>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm">
|
<div class="info text-center">
|
||||||
<div class="row">
|
{{-- <p class="d-block" style="font-size: 2rem;">{{ $tipo_usuario }}</p> --}}
|
||||||
<div class="col-sm form-group align-self-center">
|
|
||||||
<p>Nome: <input class="form-control" type="text" name=""></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm form-group align-self-center">
|
|
||||||
<p>Email: <input class="form-control" type="text" name=""></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm form-group align-self-center">
|
|
||||||
<p>Telemovel: <input class="form-control" type="text" name=""></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm form-group align-self-center">
|
|
||||||
<p>NIF: <input class="form-control" type="text" name=""></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-sm form-group align-self-center">
|
|
||||||
{{-- <p>Nova Senha: <input class="form-control" type="text" name=""></p> --}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-sm form-group align-self-center">
|
|
||||||
<a href="" class="btn btn-primary">Redefinir Senha</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="col-sm">
|
||||||
<!-- /.card-body -->
|
<div class="row">
|
||||||
|
<div class="col-sm form-group align-self-center">
|
||||||
|
<p>Nome: <input class="form-control" type="text" name="" value="{{$user->name}}"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm form-group align-self-center">
|
||||||
|
<p>Email: <input class="form-control" type="text" name="" value="{{$user->email}}"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm form-group align-self-center">
|
||||||
|
<p>Telemovel: <input class="form-control" type="text" name="" value="{{$user->user_phone}}"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm form-group align-self-center">
|
||||||
|
<p>NIF: <input class="form-control" type="text" name="" value="{{$user->user_nif}}"></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- <div class="row">
|
||||||
|
<div class="col-sm form-group align-self-center">
|
||||||
|
<p>Senha : <input class="form-control" type="password" ></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm form-group align-self-center">
|
||||||
|
<p>Confirmar Senha : <input class="form-control" type="password" ></p>
|
||||||
|
</div>
|
||||||
|
</div> --}}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm form-group align-self-center">
|
||||||
|
{{-- <p>Nova Senha: <input class="form-control" type="text" name=""></p> --}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="card-footer">
|
|
||||||
<div class="float-right">
|
|
||||||
<button type="submit" class="btn btn-primary">Guardar</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.card -->
|
<!-- /.card-body -->
|
||||||
|
|
||||||
|
<div class="card-footer">
|
||||||
|
<div class="float-right">
|
||||||
|
<button type="submit" class="btn btn-primary">Guardar</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('logout') }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="btn btn-danger">Logout</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- /.card -->
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{-- ./container-fluid" --}}
|
|
||||||
</section>
|
|
||||||
{{-- ./content --}}
|
|
||||||
|
</div>
|
||||||
|
{{-- ./container-fluid" --}}
|
||||||
|
</section>
|
||||||
|
{{-- ./content --}}
|
||||||
</div>
|
</div>
|
||||||
{{-- ./content-wrapper --}}
|
{{-- ./content-wrapper --}}
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,10 @@ class="fas fa-bars"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
@if (Auth::check())
|
@if (Auth::check())
|
||||||
<a href="{{ route('usersProfiles')}}" class="d-block">{{ Auth::user()->user_type }}
|
{{-- <a href="{{ route('usersProfiles',['id' => Auth::user()->id] )}}" class="d-block">{{ Auth::user()->user_type }}
|
||||||
</a>
|
</a> --}}
|
||||||
|
<a href="{{ route('usersProfiles',['id' => Auth::user()->id] )}}" class="d-block">{{ Auth::user()->userType->type }}</a>
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -125,12 +127,7 @@ class="fas fa-bars"></i></a>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{{-- <li class="nav-item">
|
|
||||||
<form method="POST" action="{{ route('logout') }}">
|
|
||||||
@csrf
|
|
||||||
<button type="submit" class="nav-link active">Logout</button>
|
|
||||||
</form>
|
|
||||||
</li> --}}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<input type="email" name="email" class="form-control" placeholder="Utilizador" id="email" placeholder="email">
|
<input type="email" name="email" class="form-control" placeholder="Utilizador" id="email" placeholder="email">
|
||||||
|
{{-- <input type="text" name="user_nif" id="user_nif" class="form-control" value="{{ old('user_nif') }}" required autofocus> --}}
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<span class="fas fa-user"></span>
|
<span class="fas fa-user"></span>
|
||||||
|
|
@ -52,6 +53,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- ... -->
|
<!-- ... -->
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
<body>
|
<body>
|
||||||
<h1>Olá!</h1>
|
<h1>Olá!</h1>
|
||||||
<p>Segue abaixo o link para acessar o formulário:</p>
|
<p>Segue abaixo o link para acessar o formulário:</p>
|
||||||
<a href="{{ url('/CreateUser') }}" target="_blank" style="background-color: #4CAF50; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer;">Acessar Formulário</a>
|
<a href="{{ route('formulario') }}" target="_blank" style="background-color: #4CAF50; border: none; color: white; padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; margin: 4px 2px; cursor: pointer;">Acessar Formulário</a>
|
||||||
<p>Se você não solicitou este e-mail, por favor, desconsidere.</p>
|
<p>Se você não solicitou este e-mail, por favor, desconsidere.</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
12
resources/views/email/new_user_notification.blade.php
Normal file
12
resources/views/email/new_user_notification.blade.php
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Um novo usuário para criar</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>Olá,</p>
|
||||||
|
<p>Um novo usuário foi registrado e está aguardando aprovação.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
@section('Main-content')
|
@section('Main-content')
|
||||||
<br><br>
|
<br><br>
|
||||||
|
@if (session('status'))
|
||||||
|
<div class="alert alert-success" role="alert">
|
||||||
|
{{ session('status') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-header bg-primary text-white">
|
<div class="card-header bg-primary text-white">
|
||||||
<h3 class="card-title mb-0">Enviar Formulário:</h3>
|
<h3 class="card-title mb-0">Enviar Formulário:</h3>
|
||||||
|
|
@ -13,13 +19,13 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email">Email:</label>
|
<p for='email'>Email
|
||||||
<input type="email" class="form-control" name="email" required>
|
<input type="email" class="form-control" name="email" required>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4 text-center">
|
||||||
<button type="submit" class="btn btn-primary">Enviar</button>
|
<button style="width:30%;height:90%;" type="submit" class="btn btn-primary">Enviar</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -37,7 +43,7 @@
|
||||||
<table class="table table-bordered table-striped justify-content-center">
|
<table class="table table-bordered table-striped justify-content-center">
|
||||||
<thead class="text-center">
|
<thead class="text-center">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Numero</th>
|
<th>Id</th>
|
||||||
<th>Nome</th>
|
<th>Nome</th>
|
||||||
<th>Email</th>
|
<th>Email</th>
|
||||||
<th>Verificar</th>
|
<th>Verificar</th>
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,31 @@
|
||||||
use App\Http\Controllers\userController;
|
use App\Http\Controllers\userController;
|
||||||
use App\Http\Controllers\Pending_UserController;
|
use App\Http\Controllers\Pending_UserController;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
use App\Http\Controllers\Auth\RegisteredUserController;
|
use App\Http\Controllers\Auth\RegisteredUserController;
|
||||||
|
|
||||||
|
use App\Http\Controllers\CustomRegistrationController;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Route::get('/download-template', function () {
|
||||||
|
$filePath = public_path('templateExcel/FinalTemplate .xlsx');
|
||||||
|
$fileName = 'FinalTemplate .xlsx';
|
||||||
|
|
||||||
|
return response()->download($filePath, $fileName);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Route::post('/register', [CustomRegistrationController::class, 'store'])->name('register');
|
||||||
|
|
||||||
|
Route::get('/your-verification-route/{id}/{hash}', [UserController::class, 'yourVerificationMethod'])
|
||||||
|
->middleware(['auth', 'signed', 'throttle:6,1'])
|
||||||
|
->name('verification.verify');
|
||||||
|
|
||||||
|
|
||||||
|
Route::get('/receiveThisShit', function () {
|
||||||
|
return redirect()->route('test');
|
||||||
|
})->name('verification.notice');
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -45,17 +66,7 @@
|
||||||
return view('Admin/index');
|
return view('Admin/index');
|
||||||
})->name('home');
|
})->name('home');
|
||||||
|
|
||||||
// Route::get('/', function () {
|
|
||||||
// return view('Admin/index');
|
|
||||||
// })->name('home');
|
|
||||||
|
|
||||||
// Route::get('formulario', function () {
|
|
||||||
// return view('email/formAdmin');
|
|
||||||
// })->name('formulario');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Create Users with Super Admin
|
| Create Users with Super Admin
|
||||||
|
|
@ -66,19 +77,8 @@
|
||||||
| be assigned to the "web" middleware group. Make something great!
|
| be assigned to the "web" middleware group. Make something great!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Route::get('formulario', function () {
|
|
||||||
// return view('email/FormAdmin');
|
|
||||||
// })->name('formulario');
|
|
||||||
|
|
||||||
|
|
||||||
// Route::post('formulario/receive', [Pending_UserController::class, 'store'])->name('criarUser');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| User_Type (Super_Administrador)
|
| User_Type (Super_Administrador)
|
||||||
|
|
@ -88,16 +88,7 @@
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
Route::middleware(['auth', 'verified', 'checksuperadmin'])->group(function () {
|
Route::middleware(['auth', 'verified', 'checksuperadmin'])->group(function () {
|
||||||
|
Route::get('usersProfiles/{id}', [userController::class, 'UserProfile'])->name('usersProfiles');
|
||||||
|
|
||||||
|
|
||||||
// Rotas protegidas que exigem verificação de e-mail e user_type Super_Admin
|
|
||||||
// Route::get('/register', [RegisteredUserController::class, 'create'])
|
|
||||||
// ->name('register');
|
|
||||||
// Route::post('/register', [RegisteredUserController::class, 'store']);
|
|
||||||
|
|
||||||
|
|
||||||
Route::get('usersProfiles', [userController::class, 'UserProfile'])->name('usersProfiles');
|
|
||||||
Route::post('enviar-formulario', [FormController::class, 'enviarEmail'])->name('enviar.formulario');
|
Route::post('enviar-formulario', [FormController::class, 'enviarEmail'])->name('enviar.formulario');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -127,21 +118,21 @@
|
||||||
*/
|
*/
|
||||||
Route::get('/CreateUsers', [Pending_UserController::class, 'ListPendingUsers'])->name('CreateUsers');
|
Route::get('/CreateUsers', [Pending_UserController::class, 'ListPendingUsers'])->name('CreateUsers');
|
||||||
|
|
||||||
Route::get('/CreateUsers/{id}',[Pending_UserController::class, 'ShowFormUser'])->name('ShowPendingUser');
|
Route::get('/CreateUsers/{id}', [Pending_UserController::class, 'ShowFormUser'])->name('ShowPendingUser');
|
||||||
|
|
||||||
Route::get('formulario', function () {
|
Route::get('formulario', function () {
|
||||||
return view('email/FormAdmin');
|
return view('email/FormAdmin');
|
||||||
})->name('formulario');
|
})->name('formulario');
|
||||||
|
|
||||||
Route::post('formulario/receive', [Pending_UserController::class, 'store'])->name('criarUser');
|
Route::post('formulario/receive', [Pending_UserController::class, 'store'])->name('criarUser');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Rotas protegidas que exigem verificação de e-mail e user_type Super_Admin
|
||||||
|
// Route::get('/register', [RegisteredUserController::class, 'create'])
|
||||||
|
// ->name('register');
|
||||||
|
// Route::post('/register', [RegisteredUserController::class, 'store'])
|
||||||
|
|
||||||
|
|
||||||
// Route::get('/test-email', function () {
|
// Route::get('/test-email', function () {
|
||||||
|
|
@ -157,4 +148,24 @@
|
||||||
// } else {
|
// } else {
|
||||||
// return 'Failed to send email';
|
// return 'Failed to send email';
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
// Route::get('formulario', function () {
|
||||||
|
// return view('email/FormAdmin');
|
||||||
|
// })->name('formulario');
|
||||||
|
|
||||||
|
|
||||||
|
// Route::post('formulario/receive', [Pending_UserController::class, 'store'])->name('criarUser');
|
||||||
|
|
||||||
|
|
||||||
|
// Route::get('/', function () {
|
||||||
|
// return view('Admin/index');
|
||||||
|
// })->name('home');
|
||||||
|
|
||||||
|
// Route::get('formulario', function () {
|
||||||
|
// return view('email/formAdmin');
|
||||||
|
// })->name('formulario');
|
||||||
|
|
||||||
|
// Route::get('/email/notice', function (EmailVerificationRequest $request) {
|
||||||
|
// return view('auth.verify-email');
|
||||||
|
// })->middleware(['auth'])->name('verification.notice');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user