Update settings sidebar

This commit is contained in:
Daniel Supernault 2024-01-11 02:34:43 -07:00
parent 319a20b473
commit 5f6ed85770
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
3 changed files with 262 additions and 288 deletions

View file

@ -173,7 +173,8 @@ trait HomeSettings
$user->email = $email; $user->email = $email;
if ($validate) { if ($validate) {
$user->email_verified_at = null; // auto verify admin email addresses
$user->email_verified_at = $user->is_admin == true ? now() : null;
// Prevent old verifications from working // Prevent old verifications from working
EmailVerification::whereUserId($user->id)->delete(); EmailVerification::whereUserId($user->id)->delete();
} }
@ -195,7 +196,7 @@ trait HomeSettings
$user->save(); $user->save();
$profile->save(); $profile->save();
return redirect('/settings/home')->with('status', 'Email successfully updated!'); return redirect('/settings/email')->with('status', 'Email successfully updated!');
} else { } else {
return redirect('/settings/email'); return redirect('/settings/email');
} }
@ -206,5 +207,4 @@ trait HomeSettings
{ {
return view('settings.avatar'); return view('settings.avatar');
} }
} }

View file

@ -1,33 +1,14 @@
@extends('layouts.app') @extends('settings.template')
@section('content') @section('section')
@if (session('status'))
<div class="alert alert-primary px-3 h6 text-center">
{{ session('status') }}
</div>
@endif
@if ($errors->any())
<div class="alert alert-danger px-3 h6 text-center">
@foreach($errors->all() as $error)
<p class="font-weight-bold mb-1">{{ $error }}</p>
@endforeach
</div>
@endif
@if (session('error'))
<div class="alert alert-danger px-3 h6 text-center">
{{ session('error') }}
</div>
@endif
<div class="container"> <div class="d-flex justify-content-between align-items-center">
<div class="col-12"> <div class="title d-flex align-items-center" style="gap: 1rem;">
<div class="card shadow-none border mt-5"> <p class="mb-0"><a href="/settings/home"><i class="far fa-chevron-left fa-lg"></i></a></p>
<div class="card-body"> <h3 class="font-weight-bold mb-0">Email Settings</h3>
<div class="row">
<div class="col-12 p-3 p-md-5">
<div class="title">
<h3 class="font-weight-bold">Email Settings</h3>
</div> </div>
</div>
<hr> <hr>
<form method="post" action="{{route('settings.email')}}"> <form method="post" action="{{route('settings.email')}}">
@csrf @csrf
@ -52,12 +33,4 @@
</div> </div>
</div> </div>
</form> </form>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection @endsection

View file

@ -9,11 +9,11 @@
<li class="nav-item pl-3 {{request()->is('settings/email')?'active':''}}"> <li class="nav-item pl-3 {{request()->is('settings/email')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.email')}}">Email</a> <a class="nav-link font-weight-light text-muted" href="{{route('settings.email')}}">Email</a>
</li> </li>
@if(config('pixelfed.user_invites.enabled')) {{-- @if(config('pixelfed.user_invites.enabled'))
<li class="nav-item pl-3 {{request()->is('settings/invites*')?'active':''}}"> <li class="nav-item pl-3 {{request()->is('settings/invites*')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.invites')}}">Invites</a> <a class="nav-link font-weight-light text-muted" href="{{route('settings.invites')}}">Invites</a>
</li> </li>
@endif @endif --}}
<li class="nav-item pl-3 {{request()->is('settings/media*')?'active':''}}"> <li class="nav-item pl-3 {{request()->is('settings/media*')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.media')}}">Media</a> <a class="nav-link font-weight-light text-muted" href="{{route('settings.media')}}">Media</a>
</li> </li>
@ -38,17 +38,8 @@
<li class="nav-item"> <li class="nav-item">
<hr> <hr>
</li> </li>
<li class="nav-item pl-3 {{request()->is('*import*')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.import')}}">Import</a>
</li>
<li class="nav-item pl-3 {{request()->is('settings/data-export')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.dataexport')}}">Export</a>
</li>
@if(config_cache('pixelfed.oauth_enabled') == true) @if(config_cache('pixelfed.oauth_enabled') == true)
<li class="nav-item">
<hr>
</li>
<li class="nav-item pl-3 {{request()->is('settings/applications')?'active':''}}"> <li class="nav-item pl-3 {{request()->is('settings/applications')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.applications')}}">Applications</a> <a class="nav-link font-weight-light text-muted" href="{{route('settings.applications')}}">Applications</a>
</li> </li>
@ -57,12 +48,22 @@
</li> </li>
@endif @endif
<li class="nav-item"> <li class="nav-item pl-3 {{request()->is('*import*')?'active':''}}">
<hr> <a class="nav-link font-weight-light text-muted" href="{{route('settings.import')}}">Import</a>
</li> </li>
<li class="nav-item pl-3 {{request()->is('settings/data-export')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.dataexport')}}">Export</a>
</li>
<li class="nav-item pl-3 {{request()->is('settings/labs*')?'active':''}}"> <li class="nav-item pl-3 {{request()->is('settings/labs*')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.labs')}}">Labs</a> <a class="nav-link font-weight-light text-muted" href="{{route('settings.labs')}}">Labs</a>
</li> </li>
@if(config('instance.parental_controls.enabled'))
<li class="nav-item pl-3 {{request()->is('settings/parental-controls*')?'active':''}}">
<a class="nav-link font-weight-light text-muted" href="{{route('settings.parental-controls')}}">Parental Controls</a>
</li>
@endif
</ul> </ul>
</div> </div>