FIC_Solar/SolarPower/Views/Login/Index.cshtml
2022-08-05 23:49:40 +08:00

232 lines
9.3 KiB
Plaintext

@{
Layout = null;
}
@model SolarPower.Models.LoginViewModel.LoginViewModel
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>登入 | 太陽能電站管理系統</title>
<!-- base css -->
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css">
<link id="appbundle" rel="stylesheet" media="screen, print" href="~/css/app.bundle.css">
<link id="mytheme" rel="stylesheet" media="screen, print" href="~/css/themes/cust-theme-15.css">
<link id="myskin" rel="stylesheet" media="screen, print" href="~/css/skins/skin-master.css">
<!-- Place favicon.ico in the root directory -->
<link rel="apple-touch-icon" sizes="180x180" href="~/img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="~/img/favicon/favicon-32x32.png">
<link rel="mask-icon" href="~/img/favicon/safari-pinned-tab.svg" color="#5bbad5">
<link rel="stylesheet" media="screen, print" href="~/css/page-login-alt.css">
<!-- Font Awesome -->
<link href="~/lib/fontawesome-free/css/all.min.css" rel="stylesheet" />
<!-- icheck bootstrap -->
<link href="~/lib/icheck-bootstrap/icheck-bootstrap.min.css" rel="stylesheet" />
<!-- Theme style -->
<link rel="stylesheet" href="~/css/loading.css" />
</head>
<body>
<div class="loadEffect" id="loading" style="top: 50%;">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
<div class="blankpage-form-field">
<div class="page-logo m-0 w-100 align-items-center justify-content-center rounded border-bottom-left-radius-0 border-bottom-right-radius-0 px-4">
<div class="page-logo-link press-scale-down d-flex align-items-center">
<img src="/img/logo.png" alt="SmartAdmin WebApp" aria-roledescription="logo">
<span class="page-logo-text mr-1">太陽能電站管理系統</span>
</div>
</div>
<div class="card p-4 border-top-left-radius-0 border-top-right-radius-0">
@if (ViewBag.ErrMsg != null && ViewBag.ErrMsg != "")
{
<p class="alert alert-danger">@ViewBag.ErrMsg</p>
}
<form id="login-form" asp-action="Index" method="post">
<div class="form-group">
<label class="form-label" for="username">帳號</label>
<input asp-for="Account" type="text" id="account" class="form-control" placeholder="Account">
<span asp-validation-for="Account" class="text-danger"></span>
<span class="help-block">
您的帳號
</span>
</div>
<div class="form-group">
<label class="form-label" for="password">密碼</label>
<input asp-for="Password" type="password" id="password" class="form-control" placeholder="Password" autocomplete="off">
<span asp-validation-for="Password" class="text-danger"></span>
<span class="help-block">
您的密碼
</span>
</div>
<div class="form-group text-left">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="rememberme">
<label class="custom-control-label" for="rememberme"> 記住我</label>
</div>
</div>
<button type="submit" class="btn btn-default float-right" id="login">登入</button>
</form>
</div>
<div class="blankpage-footer text-center">
<a asp-controller="Login" asp-action="ForgotPassword"><strong>忘記密碼</strong></a>
</div>
</div>
<video poster="~/img/backgrounds/clouds.png" id="bgvid" playsinline autoplay muted loop>
<source src="~/media/video/cc.webm" type="video/webm">
<source src="~/media/video/cc.mp4" type="video/mp4">
</video>
@*
<div class="login-box">
<!-- /.login-logo -->
<div class="card card-outline card-primary">
<div class="card-body">
<p class="login-box-msg">Sign in to start your session</p>
@if (ViewBag.ErrMsg != null && ViewBag.ErrMsg != "")
{
<p class="alert alert-danger">@ViewBag.ErrMsg</p>
}
<form id="login-form" asp-action="Index" method="post">
<div class="mb-3">
<div class="input-group">
<input asp-for="Account" type="text" id="account" class="form-control" placeholder="Account">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope"></span>
</div>
</div>
</div>
<span asp-validation-for="Account" class="text-danger"></span>
</div>
<div class="mb-3">
<div class="input-group">
<input asp-for="Password" type="password" id="password" class="form-control" placeholder="Password" autocomplete="off">
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<span asp-validation-for="Password" class="text-danger"></span>
</div>
<div class="row">
<div class="col-8">
@*<div class="icheck-primary">
<input type="checkbox" id="remember">
<label for="remember">
Remember Me
</label>
</div>
</div>
<div class="col-4">
<button type="submit" class="btn btn-primary btn-block">Sign In</button>
</div>
</div>
</form>
<p class="mb-1">
<a asp-action="ForgotPassword">忘記密碼?</a>
</p>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
</div>
<!-- /.login-box -->
*@
<!-- jQuery -->
<script src="~/lib/jquery/dist/jquery.js"></script>
<!-- Bootstrap 4 -->
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
@*<script src="~/js/adminlte.min.js"></script>*@
<script src="~/js/vendors.bundle.js"></script>
<script src="~/js/app.bundle.js"></script>
</body>
</html>
<script>
//$(document).ready(function () {
// var account = Cookies.get('Account');
// if (account) {
// $('#txtAccount').val(Cookies.get('Account'));
// $('#RememberMe').prop("checked", true);
// }
// else {
// $('#RememberMe').prop("checked", false);
// }
//});
var remember = false;
$(function () {
if (localStorage.getItem('solar-t') == 'true') {
document.getElementById("rememberme").checked = true;
remember = true;
$("#account").val(atob(localStorage.getItem('solar-a')));
$("#password").val(atob(localStorage.getItem('solar-p')));
}
else {
document.getElementById("rememberme").checked = false;
}
});
function showLoading() {
var i = document.getElementById("loading");
i.style.display = "block";
}
function hideLoading() {
var i = document.getElementById("loading");
i.style.display = "none";
}
$("#rememberme").click(function () {
if (remember) {
localStorage.setItem('solar-t', 'false');
localStorage.removeItem('solar-a');
localStorage.removeItem('solar-p');
remember = false;
} else {
localStorage.setItem('solar-t', 'true');
localStorage.setItem('solar-a', btoa($("#account").val()));
localStorage.setItem('solar-p', btoa($("#password").val()));
remember = true;
}
});
$("#login").click(function () {
showLoading();
});
$("#account").change(function () {
if (remember) {
localStorage.setItem('solar-a', btoa($("#account").val()));
} else {
localStorage.removeItem('solar-a');
}
});
$("#password").change(function () {
if (remember) {
localStorage.setItem('solar-p', btoa($("#password").val()));
} else {
localStorage.removeItem('solar-p');
}
});
</script>