Skip to content
This repository was archived by the owner on Aug 4, 2024. It is now read-only.

Commit abb9f15

Browse files
committed
Adds support for mobile views
Improves readability of password
1 parent 2d14717 commit abb9f15

File tree

7 files changed

+113
-12
lines changed

7 files changed

+113
-12
lines changed

src/Lithnet.Laps.Web/Lithnet.Laps.Web/Content/Site.css

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
body {
1+
@font-face {
2+
font-family: Inconsolata;
3+
src: url('webfonts/Inconsolata-Regular.ttf');
4+
}
5+
6+
body {
27
color: #666;
38
/*font-family: "Open Sans",Arial,Helvetica,sans-serif;*/
49
font-size: 13px;
@@ -28,8 +33,8 @@
2833
font-weight: 400;
2934
}
3035

31-
body {
32-
width: 400px;
36+
.content {
37+
width: 500px;
3338
margin-left: auto;
3439
margin-right: auto;
3540
padding: 10px;
@@ -157,7 +162,7 @@ body {
157162
display: block;
158163
}
159164

160-
input.resultsText {
165+
.resultsText {
161166
border-color: #f0f0f0;
162167
height: 32px;
163168
padding: 5px 10px;
@@ -188,3 +193,63 @@ input.resultsText {
188193
width: 32px;
189194
height: 32px;
190195
}
196+
197+
.password-field {
198+
font-family: Inconsolata, Consolas, Courier New, Courier, monospace;
199+
font-size: large;
200+
font-weight: bold;
201+
}
202+
203+
#copy-button {
204+
margin-left: 10px;
205+
}
206+
207+
.password-char-digit {
208+
color: darkblue;
209+
display: inline-block;
210+
}
211+
212+
.password-char-letter {
213+
color: slategray;
214+
display: inline-block;
215+
}
216+
217+
.password-char-other {
218+
color: darkred;
219+
display: inline-block;
220+
}
221+
222+
@media only screen and (max-width: 600px) {
223+
.form-container {
224+
width: auto;
225+
margin-right: 0;
226+
margin-left: 0;
227+
border: 0;
228+
margin-top: 0;
229+
box-shadow: none;
230+
}
231+
232+
/*.auth-container .auth-content {
233+
max-width: 316px;
234+
margin: 0 auto;
235+
}*/
236+
}
237+
238+
@media only screen and (max-device-width: 480px) {
239+
.content {
240+
margin-top: 0;
241+
width: 100%;
242+
}
243+
}
244+
245+
@media only screen and (max-width: 400px) {
246+
.content {
247+
width: 100%;
248+
}
249+
}
250+
251+
@media only screen and (max-height: 750px) {
252+
.content {
253+
margin-top: 0;
254+
}
255+
}
Binary file not shown.

src/Lithnet.Laps.Web/Lithnet.Laps.Web/Controllers/LapController.cs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.DirectoryServices.AccountManagement;
77
using System.Linq;
88
using System.Security.Claims;
9+
using System.Text;
910
using System.Web;
1011
using System.Web.Caching;
1112
using System.Web.Mvc;
@@ -226,12 +227,39 @@ private UserPrincipal GetCurrentUser()
226227

227228
private static LapEntryModel CreateLapEntryModel(SearchResult result)
228229
{
229-
return new LapEntryModel
230+
LapEntryModel m = new LapEntryModel
230231
{
231232
ComputerName = result.Properties[Directory.AttrSamAccountName][0].ToString(),
232233
Password = result.GetPropertyString(Directory.AttrMsMcsAdmPwd) ?? UIMessages.NoLapsPasswordPlaceholder,
233-
ValidUntil = result.GetPropertyDateTimeFromLong(Directory.AttrMsMcsAdmPwdExpirationTime)
234+
ValidUntil = result.GetPropertyDateTimeFromLong(Directory.AttrMsMcsAdmPwdExpirationTime),
234235
};
236+
237+
m.HtmlPassword = BuildHtmlPassword(m.Password);
238+
239+
return m;
240+
}
241+
242+
private static string BuildHtmlPassword(string password)
243+
{
244+
StringBuilder builder = new StringBuilder();
245+
246+
foreach (char s in password)
247+
{
248+
if (char.IsDigit(s))
249+
{
250+
builder.AppendFormat(@"<span class=""password-char-digit"">{0}</span>", s);
251+
}
252+
else if (char.IsLetter(s))
253+
{
254+
builder.AppendFormat(@"<span class=""password-char-letter"">{0}</span>", s);
255+
}
256+
else
257+
{
258+
builder.AppendFormat(@"<span class=""password-char-other"">{0}</span>", s);
259+
}
260+
}
261+
262+
return builder.ToString();
235263
}
236264

237265
[Localizable(false)]

src/Lithnet.Laps.Web/Lithnet.Laps.Web/Lithnet.Laps.Web.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@
353353
<Content Include="Content\webfonts\fa-solid-900.ttf" />
354354
<Content Include="Content\webfonts\fa-solid-900.woff" />
355355
<Content Include="Content\webfonts\fa-solid-900.woff2" />
356+
<Content Include="Content\webfonts\Inconsolata-Regular.ttf" />
356357
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
357358
<None Include="Properties\PublishProfiles\Publish to local IIS.pubxml" />
358359
<None Include="Scripts\jquery-3.3.1.intellisense.js" />

src/Lithnet.Laps.Web/Lithnet.Laps.Web/Models/LapEntryModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public class LapEntryModel
1313

1414
public string Password { get; set; }
1515

16+
public string HtmlPassword { get; set; }
17+
1618
public DateTime? ValidUntil { get; set; }
1719

1820
public string FailureReason { get; set; }

src/Lithnet.Laps.Web/Lithnet.Laps.Web/Views/Lap/Show.cshtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
<section>
2121
<label class="title">@UIMessages.Password</label>
2222
<div class="input-group">
23-
<input class="resultsText" id="pwd" type="text" value="@Model.Password" readonly="readonly" />
23+
<div class="resultsText password-field" id="pwd" >
24+
@Html.Raw(Model.HtmlPassword)
25+
</div>
2426
<span id="inputGroupAppend" class="input-group-append">
2527
<button id="copy-button" type="button" data-clipboard-target="#pwd">
2628
<i class="far fa-copy"></i>

src/Lithnet.Laps.Web/Lithnet.Laps.Web/Views/Shared/_Layout.cshtml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@
77
<title>@ConfigurationManager.AppSettings["app:Title"]</title>
88
@Styles.Render("~/Content/css")
99
<script src="@Url.Content("~/Scripts/clipboard.min.js")"></script>
10-
<link href="@Url.Content("~/Content/fontawesome/fontawesome-all.css")" type="text/css" rel="stylesheet"/>
10+
<link href="@Url.Content("~/Content/fontawesome/fontawesome-all.css")" type="text/css" rel="stylesheet" />
1111
</head>
1212
<body>
13-
<div class="app-header">
14-
<img class="app-logo" alt="@ConfigurationManager.AppSettings["app:Title"]" src="~/images/logo.png" />
15-
<div class="app-title">@ConfigurationManager.AppSettings["app:Title"]</div>
13+
<div class="content">
14+
<div class="app-header">
15+
<img class="app-logo" alt="@ConfigurationManager.AppSettings["app:Title"]" src="~/images/logo.png" />
16+
<div class="app-title">@ConfigurationManager.AppSettings["app:Title"]</div>
17+
</div>
18+
@RenderBody()
19+
1620
</div>
17-
@RenderBody()
1821

1922
@Scripts.Render("~/bundles/jquery")
2023
@Scripts.Render("~/bundles/bootstrap")

0 commit comments

Comments
 (0)