mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-22 00:03:09 +01:00
Make cleaning & Refactoring
This commit is contained in:
parent
ee1d7a3993
commit
4ea7988257
@ -1,95 +0,0 @@
|
||||
<?php
|
||||
|
||||
// @formatter:off
|
||||
/**
|
||||
* A helper file for your Eloquent Models
|
||||
* Copy the phpDocs from this file to the correct Model,
|
||||
* And remove them from this file, to prevent double declarations.
|
||||
*
|
||||
* @author Barry vd. Heuvel <barryvdh@gmail.com>
|
||||
*/
|
||||
|
||||
|
||||
namespace App\Models{
|
||||
/**
|
||||
* App\Models\Group
|
||||
*
|
||||
* @method static \Database\Factories\GroupFactory factory(...$parameters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereUserId($value)
|
||||
*/
|
||||
class Group extends \Eloquent {}
|
||||
}
|
||||
|
||||
namespace App\Models{
|
||||
/**
|
||||
* App\Models\Option
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option whereKey($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option whereValue($value)
|
||||
*/
|
||||
class Option extends \Eloquent {}
|
||||
}
|
||||
|
||||
namespace App\Models{
|
||||
/**
|
||||
* App\Models\TwoFAccount
|
||||
*
|
||||
* @method static \Database\Factories\TwoFAccountFactory factory(...$parameters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount ordered(string $direction = 'asc')
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereAlgorithm($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereCounter($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereDigits($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereGroupId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereIcon($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereLegacyUri($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereOrderColumn($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereOtpType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount wherePeriod($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereSecret($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereService($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereUserId($value)
|
||||
*/
|
||||
class TwoFAccount extends \Eloquent implements \Spatie\EloquentSortable\Sortable {}
|
||||
}
|
||||
|
||||
namespace App\Models{
|
||||
/**
|
||||
* App\Models\User
|
||||
*
|
||||
* @method static \Database\Factories\UserFactory factory(...$parameters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereEmailVerifiedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereIsAdmin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereLastSeenAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User wherePassword($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User wherePreferences($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereRememberToken($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value)
|
||||
*/
|
||||
class User extends \Eloquent implements \App\Models\WebAuthnAuthenticatable, \Laragear\WebAuthn\Contracts\WebAuthnAuthenticatable {}
|
||||
}
|
||||
|
@ -49,8 +49,10 @@ function ($langs, $langItem) {
|
||||
arsort($prefLocales);
|
||||
|
||||
// We take the first accepted language available
|
||||
$availableLocales = config('2fauth.locales');
|
||||
|
||||
foreach ($prefLocales as $locale => $weight) {
|
||||
if (in_array($locale, config('2fauth.locales'))) {
|
||||
if (in_array($locale, $availableLocales)) {
|
||||
$lang = $locale;
|
||||
break;
|
||||
}
|
||||
@ -58,8 +60,8 @@ function ($langs, $langItem) {
|
||||
}
|
||||
|
||||
$user = $request->user();
|
||||
if (! is_null($user) && $request->user()->preferences['lang'] != 'browser') {
|
||||
$lang = $request->user()->preferences['lang'];
|
||||
if (! is_null($user) && $user->preferences['lang'] != 'browser') {
|
||||
$lang = $user->preferences['lang'];
|
||||
}
|
||||
|
||||
// If the language is not available (or partial), strings will be translated using the fallback language.
|
||||
|
@ -20,6 +20,16 @@
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TwoFAccount[] $twofaccounts
|
||||
* @property-read \App\Models\User|null $user
|
||||
*
|
||||
* @method static \Database\Factories\GroupFactory factory(...$parameters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Group whereUserId($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Group extends Model
|
||||
@ -117,4 +127,5 @@ public function scopeOrphans($query)
|
||||
{
|
||||
return $query->where('user_id', null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,13 @@
|
||||
* @property string $key
|
||||
* @property string $value
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option whereKey($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Option whereValue($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Option extends Model
|
||||
|
@ -54,6 +54,28 @@
|
||||
* @property int|null $user_id
|
||||
* @property-read \App\Models\User|null $user
|
||||
*
|
||||
* @method static \Database\Factories\TwoFAccountFactory factory(...$parameters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount ordered(string $direction = 'asc')
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereAccount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereAlgorithm($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereCounter($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereDigits($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereGroupId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereIcon($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereLegacyUri($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereOrderColumn($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereOtpType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount wherePeriod($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereSecret($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereService($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|TwoFAccount whereUserId($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class TwoFAccount extends Model implements Sortable
|
||||
|
@ -48,6 +48,22 @@
|
||||
* @property-read \App\Models\AuthLog|null $latestAuthentication
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User admins()
|
||||
*
|
||||
* @method static \Database\Factories\UserFactory factory(...$parameters)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereEmail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereEmailVerifiedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereIsAdmin($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereLastSeenAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User wherePassword($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User wherePreferences($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereRememberToken($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class User extends Authenticatable implements HasLocalePreference, WebAuthnAuthenticatable
|
||||
|
Loading…
Reference in New Issue
Block a user