增加 实名认证
This commit is contained in:
parent
1a3ff7293f
commit
8459e3ac64
@ -61,6 +61,12 @@ public function store(Request $request)
|
|||||||
return $this->error('找不到服务器。');
|
return $this->error('找不到服务器。');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($server->is_china_mainland) {
|
||||||
|
if (!auth()->user()->realnamed) {
|
||||||
|
return $this->error('必须要先实名认证才能创建中国大陆的隧道。');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (Tunnel::where('server_id', $server->id)->count() > $server->max_tunnels) {
|
if (Tunnel::where('server_id', $server->id)->count() > $server->max_tunnels) {
|
||||||
return $this->error('服务器无法开设更多隧道了。');
|
return $this->error('服务器无法开设更多隧道了。');
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public function redirect(Request $request): RedirectResponse
|
|||||||
'client_id' => config('oauth.client_id'),
|
'client_id' => config('oauth.client_id'),
|
||||||
'redirect_uri' => config('oauth.callback_uri'),
|
'redirect_uri' => config('oauth.callback_uri'),
|
||||||
'response_type' => 'code',
|
'response_type' => 'code',
|
||||||
'scope' => 'user',
|
'scope' => 'user realname',
|
||||||
'state' => $state,
|
'state' => $state,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -80,10 +80,15 @@ public function callback(Request $request): RedirectResponse
|
|||||||
'name' => $oauth_user->name
|
'name' => $oauth_user->name
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// $api_token = $user->api_token;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Auth::loginUsingId($user->id, true);
|
if (!is_null($oauth_user->real_name_verified_at)) {
|
||||||
|
$user_sql->update([
|
||||||
|
'realnamed' => true
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Auth::guard('web')->loginUsingId($user->id, true);
|
||||||
|
|
||||||
return redirect()->route('index');
|
return redirect()->route('index');
|
||||||
}
|
}
|
||||||
@ -109,7 +114,7 @@ protected function password_rules(): array
|
|||||||
|
|
||||||
public function logout(): RedirectResponse
|
public function logout(): RedirectResponse
|
||||||
{
|
{
|
||||||
Auth::logout();
|
Auth::guard('web')->logout();
|
||||||
return redirect()->route('index');
|
return redirect()->route('index');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ class User extends Authenticatable
|
|||||||
'name',
|
'name',
|
||||||
'email',
|
'email',
|
||||||
'password',
|
'password',
|
||||||
'traffic'
|
'traffic',
|
||||||
|
'realnamed'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->boolean('realnamed')->default(false)->after('remember_token');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('realnamed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -36,6 +36,13 @@
|
|||||||
>文档</a
|
>文档</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a
|
||||||
|
class="nav-link text-auto"
|
||||||
|
href="/auth/logout"
|
||||||
|
>退出登录</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,12 +9,19 @@
|
|||||||
<p>剩余流量: {{ user.traffic }}GB</p>
|
<p>剩余流量: {{ user.traffic }}GB</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3" v-if="!user.realnamed">
|
||||||
|
<p>注意,您没有完成实名认证,请点击下方按钮完成实名认证,否则您只能使用中国大陆以外的隧道。</p>
|
||||||
|
<a class="btn btn-primary" target="_blank" href="https://oauth.laecloud.com/real_name">实名认证</a>
|
||||||
|
<p>在实名认证后,请重新登录 {{ sitename }}。</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import http from '../plugins/http'
|
import http from '../plugins/http'
|
||||||
|
|
||||||
|
const sitename = window.Base.SiteName
|
||||||
|
|
||||||
const user = ref({
|
const user = ref({
|
||||||
name: 'loading...',
|
name: 'loading...',
|
||||||
|
Loading…
Reference in New Issue
Block a user