Made Profile & Account Settings functional

Also moved redundant HTML markup to component file for reuse.
Username to UUID converter also added as Middleware
This commit is contained in:
2020-05-13 22:47:51 +01:00
parent 7635f8e2f4
commit 2ff0da3e4f
33 changed files with 799 additions and 258 deletions

View File

@@ -66,18 +66,20 @@
<!-- /.card-header -->
<div class="card-body p-0"> <!-- move to dedi css -->
<table class="table" style="white-space: nowrap">
<thead>
<tr>
<th style="width: 10px">#</th>
<th>Applicant</th>
<th>Application Date</th>
<th>Last Acted On</th>
<th style="width: 40px">Status</th>
<th style="width: 40px">Actions</th>
</tr>
</thead>
<tbody>
@if (!$applications->isEmpty())
<table class="table" style="white-space: nowrap">
<thead>
<tr>
<th style="width: 10px">#</th>
<th>Applicant</th>
<th>Application Date</th>
<th>Last Acted On</th>
<th style="width: 40px">Status</th>
<th style="width: 40px">Actions</th>
</tr>
</thead>
<tbody>
@foreach ($applications as $application)
@@ -125,9 +127,17 @@
@endforeach
</tbody>
</table>
</tbody>
</table>
@else
<div class="alert alert-warning">
<p><i class="fa fa-info-circle"></i> <b>Nothing to show</b></p>
<p>You currently have no applications to display. If you're eligible, you may apply once every month.</p>
</div>
@endif
</div>
<!-- /.card-body -->

View File

@@ -1,82 +0,0 @@
@extends('adminlte::page')
@section('title', 'Raspberry Network | Applications')
@section('content_header')
<h4>My Account / Approved Applications</h4>
@stop
@section('content')
<div class="row">
<div class="col">
<div class="callout callout-success">
<h5>Info on approved applications</h5>
<p>Your approved applications will appear here. Approved applicants will be promoted and notified automatically by the system.</p>
<p>Moderators will be able to review other applications.</p>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<h3 class="card-title">My Denied Applications</h3>
</div>
<!-- /.card-header -->
<div class="card-body p-0"> <!-- move to dedi css -->
<table class="table" style="white-space: nowrap">
<thead>
<tr>
<th style="width: 10px">#</th>
<th>Applicant</th>
<th>Application Date</th>
<th>Approval Date</th>
<th>Status</th>
<th style="width: 40px">Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.</td>
<td>Jonathan Smith</td>
<td>2020-04-28</td>
<td>2020-04-30</td>
<td><span class="badge bg-success">Approved</span></td>
<td>
<button type="button" class="btn btn-success btn-sm">View</button>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /.card-body -->
<div class="card-footer">
<button type="button" class="btn btn-default mr-2">Back</button>
<button type="button" class="btn btn-info mr-2" onclick="window.location.href='{{route('userDeniedApps')}}'">Denied Applications</button>
<button type="button" class="btn btn-info mr-2" onclick="window.location.href='{{route('userPendingApps')}}'">Active Applications</button>
</div>
</div>
</div>
</div>
@stop

View File

@@ -1,83 +0,0 @@
@extends('adminlte::page')
@section('title', 'Raspberry Network | Applications')
@section('content_header')
<h4>My Account / Denied Applications</h4>
@stop
@section('content')
<div class="row">
<div class="col">
<div class="callout callout-danger">
<h5>Info on denied applications</h5>
<p>Please note that all applications listed on this page have been denied by the staff team / applications team.</p>
<p>The system will only let you apply every thirty days. Your previous applications will be kept for your reference, but you can always delete them here.</p>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<div class="card-header">
<h3 class="card-title">My Denied Applications</h3>
</div>
<!-- /.card-header -->
<div class="card-body p-0"> <!-- move to dedi css -->
<table class="table" style="white-space: nowrap">
<thead>
<tr>
<th style="width: 10px">#</th>
<th>Applicant</th>
<th>Application Date</th>
<th>Denial Date</th>
<th>Status</th>
<th style="width: 40px">Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.</td>
<td>Jonathan Smith</td>
<td>2020-04-28</td>
<td>2020-04-30</td>
<td><span class="badge bg-danger">Denied</span></td>
<td>
<button type="button" class="btn btn-success btn-sm">View</button>
<button type="button" class="btn btn-danger btn-sm">Delete</button>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /.card-body -->
<div class="card-footer">
<button type="button" class="btn btn-default mr-2">Back</button>
<button type="button" class="btn btn-info mr-2">Approved Applications</button>
<button type="button" class="btn btn-info mr-2">Active Applications</button>
</div>
</div>
</div>
</div>
@stop

View File

@@ -0,0 +1,166 @@
@extends('adminlte::page')
@section('title', 'Raspberry Network | Account Settings')
@section('content_header')
<h4>My Profile / Account / Settings</h4>
@stop
@section('js')
<x-global-errors></x-global-errors>
@stop
@section('css')
<link rel="stylesheet" href="/css/acc.css">
@stop
@section('content')
<div class="modal fade" tabindex="-1" id="authenticationForm" role="dialog" aria-labelledby="authenticationFormLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="authenticationFormLabel">Please authenticate</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p class="text-muted">For your security, you'll need to re-enter your password before logging out other devices. If you believe your account has been compromised, please change your password instead, as that will automatically log out anyone else who might using your account, and prevent them from signing back in.</p>
<form method="POST" action="{{route('flushSessions')}}" id="flushSessions">
@csrf
<label for="reenter">Re-enter your password</label>
<input type="password" name="currentPasswordFlush" id="currentPasswordFlush" class="form-control" autocomplete="current-password">
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" onclick="document.getElementById('flushSessions').submit()">Confirm</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col text-center">
<div class="card">
<div class="card-body">
<h3>Welcome back, {{Auth::user()->name}}</h3>
<p class="text-muted">{{Auth::user()->email}}</p>
<a href="https://namemc.com/profile/{{Auth::user()->uuid}}" target="_blank">View @ NameMC</a>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card mt-3 tab-card">
<div class="card-header tab-card-header">
<ul class="nav nav-tabs card-header-tabs" id="myTab" role="tablist">
<li class="nav-item">
<a class="nav-link" id="accountSecurityTab" data-toggle="tab" href="#accountSecurity" role="tab" aria-controls="AccountSecurity" aria-selected="true">Account Security</a>
</li>
<li class="nav-item">
<a class="nav-link" id="twofaTab" data-toggle="tab" href="#twofa" role="tab" aria-controls="TwoFa" aria-selected="false">Two Factor Authentication</a>
</li>
<li class="nav-item">
<a class="nav-link" id="sessionsTab" data-toggle="tab" href="#sessions" role="tab" aria-controls="Sessions" aria-selected="false">Sessions</a>
</li>
<li class="nav-item">
<a class="nav-link" id="contactSettingsTab" data-toggle="tab" href="#contactSettings" role="tab" aria-controls="ContactSettings" aria-selected="false">Contact Settings (E-mail)</a>
</li>
</ul>
</div>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active p-3" id="accountSecurity" role="tabpanel" aria-labelledby="accountSecurityTab">
<h5 class="card-title">Change Password</h5>
<p class="card-text">Change your password here. This will log you out from all existing sessions for your security.</p>
<form method="POST" action="{{route('changePassword')}}" id="changePassword">
@csrf
@method('PATCH')
<label for="oldpassword">Old Password</label>
<input class="form-control" name="oldPassword" type="password" id="oldpassword" autocomplete="current-password">
<p class="text-sm text-muted">Forgot your password? Reset it <a href="/auth/password/reset">here</a></p>
<div class="form-group mt-5">
<label for="newpassword">New Password</label>
<input type="password" name="newPassword" id="newpassword" class="form-control" autocomplete="new-password">
<label for="newpassword_confirmation">Confirm Password</label>
<input type="password" name="newPassword_confirmation" id="newpassword_confirmation" autocomplete="new-password" class="form-control">
</div>
</form>
<button class="btn btn-success" type="button" onclick="document.getElementById('changePassword').submit()">Change Password</button>
</div>
<div class="tab-pane fade p-3" id="twofa" role="tabpanel" aria-labelledby="twofaTab">
<h5 class="card-title">Two-factor Authentication</h5>
<p class="card-text"><b>This feature is not yet available.</b> Support for Google Authenticator, Authy, Microsoft Authenticator and other compatible apps is coming soon, as well as fingerprint login for android devices.</p>
<button type="button" class="btn btn-primary" disabled>Enable 2FA</button>
</div>
<div class="tab-pane fade p-3" id="sessions" role="tabpanel" aria-labelledby="sessionsTab">
<h5 class="card-title">Session Manager</h5>
<p class="card-text">Terminating other sessions is generally a good idea if your account has been compromised.</p>
<p>Your current session: Logged in from {{ $ip }}</p>
<button type="button" class="btn btn-warning" onclick="$('#authenticationForm').modal('show')">Flush Sessions</button>
</div>
<div class="tab-pane fade p-3" id="contactSettings" role="tabpanel" aria-labelledby="contactSettingsTab">
<h5 class="card-title">Contact Settings</h5>
<p class="card-text">Need to change personal data? You can do so here.</p>
<form method="POST" action="{{route('changeEmail')}}" id="changeEmail">
@csrf
@method('PATCH')
<div class="form-group">
<label for="oldEmail">Current Email Address</label>
<input type="text" class="form-control" id="oldEmail" disabled value="{{Auth::user()->email}}">
<label for="newEmail">New Email Address</label>
<input type="email" name="newEmail" class="form-control mb-3" id="newEmail">
</div>
<div class="form-group mt-5">
<label for="currentPassword">Current Password</label>
<input type="password" name="currentPassword" class="form-control" id="currentPassword" autocomplete="current-password">
<p class="text-sm text-muted">For security reasons, you cannot make important account changes without confirming your password. You'll also need to verify your new email.</p>
</div>
</form>
<button class="btn btn-success" type="button" onclick="document.getElementById('changeEmail').submit()">Change Email Address</button>
</div>
</div>
</div>
</div>
</div>
</div>
@stop

File diff suppressed because one or more lines are too long