fix: password confirmation

This commit is contained in:
Andras Bacsai
2023-08-31 09:56:37 +02:00
parent 7ec560d4a2
commit 87dd819ae4
12 changed files with 21 additions and 17 deletions

View File

@@ -27,7 +27,7 @@ class Controller extends BaseController
} }
public function subscription() public function subscription()
{ {
if (!is_cloud()) { if (!isCloud()) {
abort(404); abort(404);
} }
return view('subscription.index', [ return view('subscription.index', [
@@ -37,7 +37,7 @@ class Controller extends BaseController
public function license() public function license()
{ {
if (!is_cloud()) { if (!isCloud()) {
abort(404); abort(404);
} }
return view('settings.license', [ return view('settings.license', [

View File

@@ -12,7 +12,7 @@ class ServerController extends Controller
public function new_server() public function new_server()
{ {
if (!is_cloud()) { if (!isCloud()) {
return view('server.create', [ return view('server.create', [
'limit_reached' => false, 'limit_reached' => false,
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(), 'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),

View File

@@ -53,7 +53,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
} }
} }
public function welcome() { public function welcome() {
if (is_cloud()) { if (isCloud()) {
return $this->setServerType('remote'); return $this->setServerType('remote');
} }
$this->currentState = 'select-server-type'; $this->currentState = 'select-server-type';

View File

@@ -37,7 +37,7 @@ class Change extends Component
public function mount() public function mount()
{ {
if (is_cloud() && !isDev()) { if (isCloud() && !isDev()) {
$this->webhook_endpoint = config('app.url'); $this->webhook_endpoint = config('app.url');
} else { } else {
$this->webhook_endpoint = $this->ipv4; $this->webhook_endpoint = $this->ipv4;

View File

@@ -13,7 +13,7 @@ class IsSubscriptionValid
if (isInstanceAdmin()) { if (isInstanceAdmin()) {
return $next($request); return $next($request);
} }
if (!auth()->user() || !is_cloud()) { if (!auth()->user() || !isCloud()) {
if ($request->path() === 'subscription') { if ($request->path() === 'subscription') {
return redirect('/'); return redirect('/');
} else { } else {

View File

@@ -217,7 +217,7 @@ function isDev(): bool
return config('app.env') === 'local'; return config('app.env') === 'local';
} }
function is_cloud(): bool function isCloud(): bool
{ {
return !config('coolify.self_hosted'); return !config('coolify.self_hosted');
} }

View File

@@ -6,7 +6,7 @@
href="{{ route('settings.configuration') }}"> href="{{ route('settings.configuration') }}">
<button>Configuration</button> <button>Configuration</button>
</a> </a>
@if (is_cloud()) @if (isCloud())
<a class="{{ request()->routeIs('settings.license') ? 'text-white' : '' }}" <a class="{{ request()->routeIs('settings.license') ? 'text-white' : '' }}"
href="{{ route('settings.license') }}"> href="{{ route('settings.license') }}">
<button>Resale License</button> <button>Resale License</button>

View File

@@ -1,7 +1,7 @@
<div> <div>
<form wire:submit.prevent='submit' class="flex flex-col"> <form wire:submit.prevent='submit' class="flex flex-col">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<h3>General</h3> <h2>General</h2>
<x-forms.button type="submit" label="Save">Save</x-forms.button> <x-forms.button type="submit" label="Save">Save</x-forms.button>
</div> </div>
<div class="flex gap-2"> <div class="flex gap-2">

View File

@@ -90,7 +90,7 @@
<h2>Register a GitHub App</h2> <h2>Register a GitHub App</h2>
<div class="pt-1 pb-2 ">You need to register a GitHub App before using this source.</div> <div class="pt-1 pb-2 ">You need to register a GitHub App before using this source.</div>
<div class="pt-2 pb-10"> <div class="pt-2 pb-10">
@if (!is_cloud() || isDev()) @if (!isCloud() || isDev())
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
<x-forms.select wire:model='webhook_endpoint' label="Webhook Endpoint" <x-forms.select wire:model='webhook_endpoint' label="Webhook Endpoint"
helper="All Git webhooks will be sent to this endpoint. <br><br>If you would like to use domain instead of IP address, set your Coolify instance's FQDN in the Settings menu."> helper="All Git webhooks will be sent to this endpoint. <br><br>If you would like to use domain instead of IP address, set your Coolify instance's FQDN in the Settings menu.">

View File

@@ -11,7 +11,7 @@
manually. manually.
</div> </div>
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<form action="/user/confirmed-two-factor-authentication" method="POST" class="flex items-end w-32 gap-2"> <form action="/user/confirmed-two-factor-authentication" method="POST" class="flex items-end gap-2">
@csrf @csrf
<x-forms.input type="number" id="code" label="One-time code" required /> <x-forms.input type="number" id="code" label="One-time code" required />
<x-forms.button type="submit">Validate 2FA</x-forms.button> <x-forms.button type="submit">Validate 2FA</x-forms.button>
@@ -19,11 +19,11 @@
<div> <div>
<div>{!! $request->user()->twoFactorQrCodeSvg() !!}</div> <div>{!! $request->user()->twoFactorQrCodeSvg() !!}</div>
<div x-data="{ showCode: false }" class="py-2"> <div x-data="{ showCode: false }" class="py-2">
<x-forms.button x-on:click="showCode = !showCode">Show secret key to manually
enter</x-forms.button>
<template x-if="showCode"> <template x-if="showCode">
<div class="py-2 ">{!! decrypt($request->user()->two_factor_secret) !!}</div> <div class="py-2 ">{!! decrypt($request->user()->two_factor_secret) !!}</div>
</template> </template>
<x-forms.button x-on:click="showCode = !showCode">Show secret key to manually
enter</x-forms.button>
</div> </div>
</div> </div>
</div> </div>
@@ -43,7 +43,7 @@
</div> </div>
@else @else
@if ($request->user()->two_factor_confirmed_at) @if ($request->user()->two_factor_confirmed_at)
<div class=""> Two factor authentication is <span class="text-helper">enabled</span>.</div> <div class="pb-4 "> Two factor authentication is <span class="text-helper">enabled</span>.</div>
<div class="flex gap-2"> <div class="flex gap-2">
<form action="/user/two-factor-authentication" method="POST"> <form action="/user/two-factor-authentication" method="POST">
@csrf @csrf
@@ -69,11 +69,15 @@
</div> </div>
@endif @endif
@else @else
<div class="pb-2 ">Two factor authentication is <span class="text-helper">disabled</span>.</div>
<form action="/user/two-factor-authentication" method="POST"> <form action="/user/two-factor-authentication" method="POST">
@csrf @csrf
<x-forms.button type="submit">Configure 2FA</x-forms.button> <x-forms.button type="submit">Configure 2FA</x-forms.button>
</form> </form>
@endif @endif
@endif @endif
@if (session()->has('errors'))
<div class="text-error">
Something went wrong. Please try again.
</div>
@endif
</x-layout> </x-layout>

View File

@@ -3,7 +3,7 @@
->user() ->user()
->currentTeam()" /> ->currentTeam()" />
<livewire:team.form /> <livewire:team.form />
@if (is_cloud()) @if (isCloud())
<div class="pb-8"> <div class="pb-8">
<h2>Subscription</h2> <h2>Subscription</h2>
@if (data_get(currentTeam(), @if (data_get(currentTeam(),