@model LaneFlowReport.Models.LoginViewModel
<div class="container text-center mt-5">
    <h1 class="display-4">@ViewBag.Title</h1>
</div>

<form method="post" class="mt3">
    <div class="form-group">
        <label for="Username">使用者名稱：</label>
        <input type="text" id="Username" name="Username" class="form-control small" placeholder="請輸入帳號" value="@Model.Username" required />
    </div>
    <div class="form-group">
        <label for="Password">密碼：</label>
        <input type="password" id="Password" name="Password" class="form-control small" required />
    </div>
    <div class="text-center mt-2">
        <button type="submit" class="btn btn-primary mx-1">登入</button>
        <button id="loginBtn" type="button" class="btn btn-secondary">Line</button>
    </div>
    @if (ViewData.ModelState.ErrorCount > 0)
    {
        <div style="color:red;">@Html.ValidationSummary()</div>
    }
</form>
<script>
    document.getElementById("loginBtn").addEventListener("click", function () {
        const currentUrl = `${location.origin}/Login/LoginCallback`;
        location.href = '@ViewBag.OauthUrl' + `?redirect_uri=${currentUrl}`;
    });
</script>
