<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BladeX 统一认证系统</title>
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/iofrm-style.css">
    <link rel="stylesheet" type="text/css" href="/static/css/iofrm-theme.css">
</head>
<body>
<div class="form-body">
    <div class="row">
        <div class="form-holder">
            <div class="form-content">
                <div class="form-items">
                    <div class="website-logo-inside">
                        <img class="logo-size" src="/static/images/bladex-logo.png">
                        <h1>BladeX 统一认证系统</h1>
                    </div>
                    <p th:text="'应用 [' + ${client_id} + '] 请求授权'">应用 [未获取到应用信息] 请求授权</p>
                    <p>授权后该应用将取得系统操作权限</p>
                    <div class="page-links">
                        <a th:text="'授权账号 [' + ${username} + '] 请求授权'">授权账号 [未获取到账号信息]</a>
                    </div>
                    <form action="/oauth/authorize/perform" method="post">
                        <input name='approval' value='true' type='hidden'/>
                        <input id='state' name='state' th:value="${state}" type='hidden'/>
                        <div class="form-button">
                            <button id="submit" type="submit" class="ibtn">同意/授权</button>
                            <button id="logout" class="lbtn">退出登录</button>
                        </div>
                    </form>
                </div>
                <div class="other-links">
                    <span>Copyrights © 2024 <a href="https://bladex.cn" target="_blank">BladeX</a> All Rights Reserved.</span>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/popper.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script>
    $(window).on("load", function () {
       // 初始化页面增加租户id传递
       const state = getUrlParam("state");
       if (state !== null && state !== "") {
           $("#state").val(state);
       }
    });

    $("#logout").click(function(){
        window.location.href = "/oauth/authorize/logout";
    });

    // 获取url中参数的值
    function getUrlParam(name) {
        const urlParams = new URLSearchParams(window.location.search);
        return urlParams.get(name);
    }
</script>
</body>
</html>
