Update sudo mode checkpoint view design

This commit is contained in:
Daniel Supernault 2023-04-26 02:56:59 -06:00
parent 86c472ac19
commit 091e0b2cb2
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 134 additions and 40 deletions

View file

@ -24,13 +24,24 @@
</div> </div>
<div class="card bg-glass"> <div class="card bg-glass">
<div class="card-body"> <div class="card-body">
<form method="POST"> <form method="POST" id="2faForm">
@csrf @csrf
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<input id="code" type="text" class="form-control{{ $errors->has('code') ? ' is-invalid' : '' }}" name="code" placeholder="{{__('Two-Factor Authentication Code')}}" required autocomplete="off" autofocus="" inputmode="numeric" minlength="6"> <label class="font-weight-bold small text-muted">2FA Code</label>
<input
id="code"
type="text"
class="form-control{{ $errors->has('code') ? ' is-invalid' : '' }}"
name="code"
placeholder="{{__('Two-Factor Authentication Code')}}"
required
autocomplete="new-password"
autofocus=""
inputmode="numeric"
minlength="6">
@if ($errors->has('code')) @if ($errors->has('code'))
<span class="invalid-feedback"> <span class="invalid-feedback">
@ -42,7 +53,12 @@
<div class="form-group row mb-0"> <div class="form-group row mb-0">
<div class="col-md-12"> <div class="col-md-12">
<button type="submit" class="btn btn-success btn-block rounded-pill font-weight-bold"> <button
type="button"
id="sbtn"
class="btn btn-success btn-block rounded-pill font-weight-bold"
onclick="event.preventDefault();handleSubmit()"
>
{{ __('Verify') }} {{ __('Verify') }}
</button> </button>
@ -66,3 +82,24 @@
</div> </div>
</div> </div>
@endsection @endsection
@push('scripts')
<script type="text/javascript">
function handleSubmit() {
let warning = document.querySelector('.invalid-feedback');
if(warning) {
warning.style.display = 'none';
}
let code = document.getElementById('code');
code.setAttribute('readonly', 'readonly');
code.style.opacity = '20%';
let btn = document.getElementById('sbtn');
btn.classList.add('disabled');
btn.setAttribute('disabled', 'disabled');
btn.innerHTML = '<div class="spinner-border spinner-border-sm" role="status"><span class="sr-only">Loading...</span></div>';
document.getElementById('2faForm').submit()
}
</script>
@endpush

View file

@ -1,20 +1,37 @@
@extends('layouts.blank') @extends('layouts.blank')
@push('styles')
<link href="{{ mix('css/landing.css') }}" rel="stylesheet">
<link rel="preload" as="image" href="{{ url('/_landing/bg.jpg')}}" />
@endpush
@section('content') @section('content')
<div class="container mt-5"> <div class="page-wrapper">
<div class="container mt-5">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-lg-5"> <div class="col-lg-5">
<div class="text-center"> <div class="text-center">
<img src="/img/pixelfed-icon-color.svg" height="60px"> <a href="/">
<p class="font-weight-light h3 py-4">Confirm password to continue</p> <img src="/img/pixelfed-icon-white.svg" height="60px">
</a>
<h1 class="pt-4 pb-1">Sudo Mode</h1>
<p class="font-weight-light lead pb-2">Confirm password to continue</p>
</div> </div>
<div class="card"> <div class="card bg-glass">
<div class="card-body"> <div class="card-body">
<form method="POST"> <form method="POST" id="sudoForm">
@csrf @csrf
<div class="form-group"> <div class="form-group">
<input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="{{__('Password')}}" required> <label class="font-weight-bold small text-muted">Confirm Password</label>
<input
id="password"
type="password"
class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}"
name="password"
autocomplete="new-password"
placeholder="{{__('Password')}}"
required>
@if ($errors->has('password')) @if ($errors->has('password'))
<span class="invalid-feedback"> <span class="invalid-feedback">
@ -24,15 +41,19 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="custom-control custom-checkbox"> <div class="custom-control custom-checkbox" id="trusted-device">
<input type="checkbox" class="custom-control-input" id="trusted-device" name="trustDevice"> <input type="checkbox" class="custom-control-input" name="trustDevice">
<label class="custom-control-label text-muted" for="trusted-device">Trust this device and don't ask again</label> <label class="custom-control-label text-muted" for="trusted-device">Trust this device and don't ask again</label>
</div> </div>
</div> </div>
<div class="form-group row mb-0"> <div class="form-group row mb-0">
<div class="col-md-12"> <div class="col-md-12">
<button type="submit" class="btn btn-success btn-block font-weight-bold"> <button
type="button"
id="sbtn"
class="btn btn-success rounded-pill btn-block font-weight-bold"
onclick="event.preventDefault();handleSubmit()">
{{ __('Confirm Password') }} {{ __('Confirm Password') }}
</button> </button>
@ -41,7 +62,43 @@
</form> </form>
</div> </div>
</div> </div>
<div class="d-flex justify-content-between my-3">
<p class="mb-0 small">
<span class="text-muted">Logged in as:</span> {{request()->user()->username}}
</p>
<form action="/logout" method="post">
@csrf
<button type="submit" class="btn btn-link p-0 btn-sm text-white font-weight-bold">Logout</button>
</form>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection
@push('scripts')
<script type="text/javascript">
function handleSubmit() {
let warning = document.querySelector('.invalid-feedback');
if(warning) {
warning.style.display = 'none';
}
let email = document.getElementById('password');
email.setAttribute('readonly', 'readonly');
email.style.opacity = '20%';
let trustedDevice = document.getElementById('trusted-device');
trustedDevice.style.opacity = '20%';
let btn = document.getElementById('sbtn');
btn.classList.add('disabled');
btn.setAttribute('disabled', 'disabled');
btn.innerHTML = '<div class="spinner-border spinner-border-sm" role="status"><span class="sr-only">Loading...</span></div>';
document.getElementById('sudoForm').submit()
}
</script>
@endpush