Merge pull request #14799 from marcusmoore/chore/remove-unused-component

Removed unused Livewire component
This commit is contained in:
snipe 2024-05-31 00:54:43 +01:00 committed by GitHub
commit ee8931f886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 181 deletions

View file

@ -1,75 +0,0 @@
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Log;
class LoginForm extends Component
{
public $username = '';
public $password = '';
public $can_submit = false;
/**
* Set the validation rules for login
*
* @author A. Gianotto <snipe@snipe.net>
* @version v6.0
* @return Array
*/
public function rules()
{
return [
'username' => 'required|string|max:255',
'password' => 'required',
];
}
/**
* Perform the validation
*
* @author A. Gianotto <snipe@snipe.net>
* @version v6.0
*/
public function updated($fields)
{
if (is_null($fields) || empty($fields)) {
$this->can_submit = false;
}
$whatever = $this->validateOnly($fields);
$errors = $this->getErrorBag();
$this->can_submit = $this->username !== "" && $this->password !== "" && !$errors->has('username') && !$errors->has('password') ; // wait, what?
Log::info("Oy - can we submit yet?!".$this->can_submit);
}
/**
* Actually do the login thing
*
* @todo fix missing LDAP stuff maybe? Not sure if it
* makes sense to even do this via LiveWire, since
* our login system is pretty complicated.
*
* @author A. Gianotto <snipe@snipe.net>
* @version v6.0
*/
public function submitForm()
{
//$this->can_submit = true;
if (auth()->attempt($this->validate())) {
return redirect()->intended('/');
} else {
return session()->flash('error', trans('auth/message.account_not_found'));
}
}
}

View file

@ -1,106 +0,0 @@
<div>
<form role="form" method="POST" action="{{ route('login') }}" autocomplete="false" wire:submit.prevent="submitForm">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<!-- this is a hack to prevent Chrome from trying to autocomplete fields -->
<input type="text" name="prevent_autofill" id="prevent_autofill" value="" style="display:none;" aria-hidden="true">
<input type="password" name="password_fake" id="password_fake" value="" style="display:none;" aria-hidden="true">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<div class="box login-box">
<div class="box-header with-border">
<h1 class="box-title"> {{ trans('auth/general.login_prompt') }}</h1>
</div>
<div class="login-box-body">
<div class="row">
@if ($snipeSettings->login_note)
<div class="col-md-12">
<div class="alert alert-info">
{!! Parsedown::instance()->text(e($snipeSettings->login_note)) !!}
</div>
</div>
@endif
<!-- Notifications -->
@include('notifications')
<div class="col-md-12">
<!-- CSRF Token -->
<fieldset>
<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
<label for="username">
<i class="fas fa-user" aria-hidden="true"></i>
{{ trans('admin/users/table.username') }}
</label>
<input class="form-control" placeholder="{{ trans('admin/users/table.username') }}" name="username" type="text" autocomplete="off" wire:model="username">
@error('username')
<span class="alert-msg">
{{ $message }}
</span>
@enderror
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password">
<i class="fas fa-key" aria-hidden="true"></i>
{{ trans('admin/users/table.password') }}
</label>
<input class="form-control" placeholder="{{ trans('admin/users/table.password') }}" name="password" type="password" wire:model="password" autocomplete="off">
@error('password')
<span class="alert-msg">
{{ $message }}
</span>
@enderror
</div>
<div class="form-group">
<div class="checkbox">
<label class="form-control">
<input name="remember" type="checkbox" value="1">
{{ trans('auth/general.remember_me') }}
</label>
</div>
</div>
</fieldset>
</div> <!-- end col-md-12 -->
</div> <!-- end row -->
@if ($snipeSettings->saml_enabled)
<div class="row">
<div class="text-right col-md-12">
<a href="{{ route('saml.login') }}">{{ trans('auth/general.saml_login') }}</a>
</div>
</div>
@endif
</div>
<div class="box-footer">
<button class="btn btn-lg btn-primary btn-block" type="submit"{{ $can_submit ? '' : ' disabled' }}>
<i wire:loading wire:target='submitForm' class="fas fa-spin fa-spinner"></i> {{ trans('auth/general.login') }}</button>
</div>
<div class="text-right col-md-12 col-sm-12 col-xs-12" style="padding-top: 10px;">
@if ($snipeSettings->custom_forgot_pass_url)
<a href="{{ $snipeSettings->custom_forgot_pass_url }}" rel="noopener">{{ trans('auth/general.forgot_password') }}</a>
@else
<a href="{{ route('password.request') }}">{{ trans('auth/general.forgot_password') }}</a>
@endif
</div>
</div> <!-- end login box -->
</div> <!-- col-md-4 -->
</div> <!-- end row -->
</div> <!-- end container -->
</form>
</div>