Api Key view
This commit is contained in:
parent
cd7c0be03d
commit
82cec8eece
4 changed files with 48 additions and 2 deletions
|
|
@ -19,5 +19,7 @@ namespace isn.Data.ApiKeys
|
||||||
public int ValidityPeriodInDays{ get; set; }
|
public int ValidityPeriodInDays{ get; set; }
|
||||||
|
|
||||||
public DateTime CreationDate { get; set; }
|
public DateTime CreationDate { get; set; }
|
||||||
|
|
||||||
|
public bool IsValid => CreationDate.AddDays(ValidityPeriodInDays) > DateTime.Now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -37,9 +37,21 @@
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
@Html.DisplayNameFor(model => model.ProtectedValue)
|
@Html.DisplayNameFor(model => model.ProtectedValue)
|
||||||
|
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@Html.DisplayFor(model => model.ProtectedValue)
|
<code>
|
||||||
|
<input id="key" value="@Model.ProtectedValue" readonly/></code>
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-success" autocomplete="off"
|
||||||
|
onclick="$('#key').select();document.execCommand('copy');"
|
||||||
|
>Copy</button>
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.ApiKey.IsValid)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.ApiKey.IsValid)
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,11 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach (var item in Model.ApiKey) {
|
@foreach (var item in Model.ApiKey) {
|
||||||
<tr>
|
var rcsscl = item.IsValid ?
|
||||||
|
item.CreationDate.AddDays(item.ValidityPeriodInDays-30) > DateTime.Now ?
|
||||||
|
"ok" : "nomoretam" : "expired";
|
||||||
|
|
||||||
|
<tr class="@rcsscl">
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.User.Id)
|
@Html.DisplayFor(modelItem => item.User.Id)
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -22,3 +22,31 @@
|
||||||
height: 100px; }
|
height: 100px; }
|
||||||
.grants-page .card label {
|
.grants-page .card label {
|
||||||
font-weight: bold; }
|
font-weight: bold; }
|
||||||
|
|
||||||
|
.expired {
|
||||||
|
color: white;
|
||||||
|
background-color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ok {
|
||||||
|
font-weight: bolder;
|
||||||
|
color: white;
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.nomoretam {
|
||||||
|
font-weight: bolder;
|
||||||
|
color: black;
|
||||||
|
background-color: orange;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ok a {
|
||||||
|
color: rgb(47, 228, 228);
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ok a:hover {
|
||||||
|
color: rgb(119, 255, 255);
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue