1. 密碼 bug fix

2. 固定地圖總覽
This commit is contained in:
Kai 2021-08-19 12:07:57 +08:00
parent 3bfb4ba11b
commit c6a9d9653b
7 changed files with 104 additions and 50 deletions

View File

@ -69,9 +69,9 @@ namespace SolarPower.Controllers
totalRecords = roles.Count(); totalRecords = roles.Count();
recFilter = roles.Count(); recFilter = roles.Count();
foreach(var role in roles) foreach (var role in roles)
{ {
if(role.Layer == (int)RoleLayerEnum.PlatformAdmin || role.Layer == (int)RoleLayerEnum.CompanyAdmin) if (role.Layer == (int)RoleLayerEnum.PlatformAdmin || role.Layer == (int)RoleLayerEnum.CompanyAdmin)
{ //管理階層的角色無法被刪除 { //管理階層的角色無法被刪除
role.Function = "<button class='btn btn-primary edit-btn'>修改</button>"; role.Function = "<button class='btn btn-primary edit-btn'>修改</button>";
} }
@ -170,7 +170,7 @@ namespace SolarPower.Controllers
} }
if(!IsPlatformLayer(myUser.Role.Layer) && myUser.CompanyId != post.SelectedCompanyId) if (!IsPlatformLayer(myUser.Role.Layer) && myUser.CompanyId != post.SelectedCompanyId)
{ //非平台人員,就只能新增自己公司的角色 { //非平台人員,就只能新增自己公司的角色
apiResult.Code = "9993"; apiResult.Code = "9993";
apiResult.Msg = errorCode.GetString(apiResult.Code); apiResult.Msg = errorCode.GetString(apiResult.Code);
@ -202,11 +202,33 @@ namespace SolarPower.Controllers
"CreatedBy", "CreatedBy",
}; };
await roleRepository.AddAsync(role, properties); var id = await roleRepository.AddOneAsync(role, properties);
#endregion
#region ()
List<RoleAuth> roleAuths = new List<RoleAuth>();
RoleAuth roleAuth = new RoleAuth();
roleAuth.Id = role.Id;
roleAuth.AuthCode = "A";
roleAuth.CreatedBy = myUser.Id;
roleAuths.Add(roleAuth);
List<string> roleAuth_properties = new List<string>()
{
"Id",
"AuthCode",
"CreatedBy",
};
await roleRepository.AddRoleAuthAsync(roleAuths, roleAuth_properties);
#endregion
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Msg = "儲存成功"; apiResult.Msg = "儲存成功";
#endregion
} }
else else
{ {

View File

@ -174,7 +174,6 @@ namespace SolarPower.Controllers
{ {
"Password", "Password",
"UpdatedBy", "UpdatedBy",
"UpdatedAt",
"Id" "Id"
}; };
@ -186,6 +185,7 @@ namespace SolarPower.Controllers
catch (Exception exception) catch (Exception exception)
{ {
apiResult.Code = "9999"; apiResult.Code = "9999";
apiResult.Msg = errorCode.GetString(apiResult.Code);
string json = System.Text.Json.JsonSerializer.Serialize(post); string json = System.Text.Json.JsonSerializer.Serialize(post);
Logger.LogError("【" + controllerName + "/" + actionName + "】"); Logger.LogError("【" + controllerName + "/" + actionName + "】");
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);

View File

@ -312,7 +312,7 @@
"info": true, "info": true,
"autoWidth": false, "autoWidth": false,
"responsive": true, "responsive": true,
"order": [[1, "desc"]], // "order": [[1, "desc"]],
"columns": [{ "columns": [{
"data": "authCode" "data": "authCode"
}, { }, {
@ -329,9 +329,13 @@
'className': 'dt-body-center', 'className': 'dt-body-center',
'render': function (data, type, full, meta) { 'render': function (data, type, full, meta) {
var check_html = ""; var check_html = "";
var disabled = "";
check_html += '<div class="custom-control custom-checkbox">'; check_html += '<div class="custom-control custom-checkbox">';
if (full.checkAuth > 0) { if (full.checkAuth > 0) {
check_html += '<input type="checkbox" class="custom-control-input" name="selectedAuthPage[]" id="auth-page-' + data + '" value="' + data + '" checked /> '; if (data == 'A') {
disabled = "disabled";
}
check_html += '<input type="checkbox" class="custom-control-input" name="selectedAuthPage[]" id="auth-page-' + data + '" value="' + data + '" checked ' + disabled + ' /> ';
} else { } else {
check_html += '<input type="checkbox" class="custom-control-input" name="selectedAuthPage[]" id="auth-page-' + data + '" value="' + data + '" /> '; check_html += '<input type="checkbox" class="custom-control-input" name="selectedAuthPage[]" id="auth-page-' + data + '" value="' + data + '" /> ';
} }

View File

@ -7,22 +7,34 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>後台管理 | 忘記密碼</title> <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 --> <!-- Font Awesome -->
<link href="~/lib/fontawesome-free/css/all.min.css" rel="stylesheet" /> <link href="~/lib/fontawesome-free/css/all.min.css" rel="stylesheet" />
<!-- icheck bootstrap --> <!-- icheck bootstrap -->
<link href="~/lib/icheck-bootstrap/icheck-bootstrap.min.css" rel="stylesheet" /> <link href="~/lib/icheck-bootstrap/icheck-bootstrap.min.css" rel="stylesheet" />
<!-- AdminLTE -->
<link href="~/css/adminlte.min.css" rel="stylesheet" />
</head> </head>
<body class="hold-transition login-page"> <body>
<div class="login-box"> <div class="blankpage-form-field">
<div class="card card-outline card-primary"> <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="card-header text-center"> <a href="javascript:void(0)" class="page-logo-link press-scale-down d-flex align-items-center">
<a href="../../index2.html" class="h1"><b>Admin</b>LTE</a> <img src="~/img/logo.png" alt="SmartAdmin WebApp" aria-roledescription="logo">
<span class="page-logo-text mr-1">太陽能電站管理系統</span>
<i class="fal fa-angle-down d-inline-block ml-1 fs-lg color-primary-300"></i>
</a>
</div> </div>
<div class="card-body"> <div class="card p-4 border-top-left-radius-0 border-top-right-radius-0">
<p class="login-box-msg">忘記密碼</p>
@if (ViewBag.ErrMsg != null && ViewBag.ErrMsg != "") @if (ViewBag.ErrMsg != null && ViewBag.ErrMsg != "")
{ {
<p class="alert alert-danger">@ViewBag.ErrMsg</p> <p class="alert alert-danger">@ViewBag.ErrMsg</p>
@ -41,24 +53,30 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<button type="submit" class="btn btn-primary btn-block">取得新密碼</button> <button type="submit" class="btn btn-default float-right">取得新密碼</button>
</div> </div>
<!-- /.col --> <!-- /.col -->
</div> </div>
</form> </form>
<p class="mt-3 mb-1">
<a href="/Login/Index">登入</a>
</p>
</div> </div>
<!-- /.login-card-body --> <div class="blankpage-footer text-center">
<a asp-controller="Login" asp-action="Index"><strong>返回登入</strong></a>
</div> </div>
</div> </div>
<!-- /.login-box -->
<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>
<!-- jQuery --> <!-- jQuery -->
<script src="~/lib/jquery/dist/jquery.js"></script> <script src="~/lib/jquery/dist/jquery.js"></script>
<!-- Bootstrap 4 --> <!-- Bootstrap 4 -->
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script> <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App --> <!-- AdminLTE App -->
<script src="~/js/adminlte.min.js"></script> @*<script src="~/js/adminlte.min.js"></script>*@
<script src="~/js/vendors.bundle.js"></script>
<script src="~/js/app.bundle.js"></script>
</body> </body>
</html> </html>

View File

@ -67,7 +67,7 @@
</form> </form>
</div> </div>
<div class="blankpage-footer text-center"> <div class="blankpage-footer text-center">
<a href="#"><strong>忘記密碼</strong></a> | <a href="#"><strong>申請帳號</strong></a> <a asp-controller="Login" asp-action="ForgotPassword"><strong>忘記密碼</strong></a> | <a href="#"><strong>申請帳號</strong></a>
</div> </div>
</div> </div>

View File

@ -350,6 +350,16 @@
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
$(td).html(row + 1) $(td).html(row + 1)
} }
}, {
'targets': 7,
'searchable': false,
'orderable': false,
'className': 'dt-body-center',
"createdCell": function (td, cellData, rowData, row, col) {
if (rowData.authCode == 'A') {
$(td).html("");
}
}
}], }],
"language": { "language": {
"emptyTable": "查無資料", "emptyTable": "查無資料",
@ -411,7 +421,7 @@
"autoWidth": false, "autoWidth": false,
"responsive": false, "responsive": false,
"deferLoading": 0, "deferLoading": 0,
"order": [[1, "desc"]], // "order": [[1, "desc"]],
"columns": [{ "columns": [{
"data": "authCode" "data": "authCode"
}, { }, {

View File

@ -77,7 +77,7 @@ function SavePersonalInfo() {
//#region 變更密碼表單驗證 //#region 變更密碼表單驗證
$(function () { $(function () {
jQuery.validator.addMethod("pwcheck", function (value, element) { jQuery.validator.addMethod("pwcheck", function (value, element) {
var xxx = /^[A-Za-z0-9\d=!\-@._*]*$/.test(value); var xxx = /^[A-Za-z0-9\d=!@#$%^&+=]*$/.test(value);
return xxx;// consists of only these return xxx;// consists of only these
//&& /[a-z]/.test(value) // has a lowercase letter //&& /[a-z]/.test(value) // has a lowercase letter
//&& /\d/.test(value) // has a digit //&& /\d/.test(value) // has a digit
@ -103,10 +103,10 @@ $(function () {
}, },
messages: { messages: {
new_password_modal: { new_password_modal: {
pwcheck: "密碼格式錯誤" pwcheck: "密碼格式錯誤,格式需為大小寫英文或數字或特殊符號【!@#$%^&+=】"
}, },
again_password_modal: { again_password_modal: {
pwcheck: "密碼格式錯誤", pwcheck: "密碼格式錯誤,格式需為大小寫英文或數字或特殊符號【!@#$%^&+=】",
equalTo: "兩次密碼輸入不同" equalTo: "兩次密碼輸入不同"
} }
} }