Skip to content

Commit

Permalink
Merge pull request #225 from vsimakhin/fix/auth
Browse files Browse the repository at this point in the history
Fix/auth
  • Loading branch information
vsimakhin authored May 20, 2024
2 parents c865f84 + 796ebbf commit 2d902f0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [Unreleased]

- Fix: Proper password field validation on Save
- Update: Support for submit button (on Enter key) on login page
- Fix: Add horizontal scrolling for the logbook page to properly support mobile devices
- Fix: Add dynamic resizing for the charts on Stats pages
- Fix: Instructor's hours for the Total Stats table were mixed up for the last 90 days and the last 12 months
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ You also can easily export all flight records into EASA style pdf format, print

## [Unreleased]

- Fix: Proper password field validation on Save
- Update: Support for submit button (on Enter key) on login page
- Fix: Add horizontal scrolling for the logbook page to properly support mobile devices
- Fix: Add dynamic resizing for the charts on Stats pages
- Fix: Instructor's hours for the Total Stats table were mixed up for the last 90 days and the last 12 months
Expand Down
11 changes: 10 additions & 1 deletion app/static/js/wlb-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,22 @@ const settingsUtils = function () {
}
}

const validatePasswordField = (field) => {
if (!field.value) {
if (document.getElementById("previous_auth_value").value == "false") {
return updateFieldValidity(field, false);
}
}
return commonUtils.updateFieldValidity(field, true);
}

/**
* Validates the coomon settings fields.
*/
const validateFields = () => {
const fields = [
{ name: "login", validator: commonUtils.validateRequiredField, error: "Login field is empty\r\n" },
{ name: "password", validator: commonUtils.validateRequiredField, error: "Password field is empty\r\n" },
{ name: "password", validator: validatePasswordField, error: "Password field is empty\r\n" },
]
const errorMessage = commonUtils.validateFields(fields);

Expand Down
4 changes: 2 additions & 2 deletions app/templates/login.page.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="card">
<div class="card-body">
<div class="m-sm-3">
<form>
<form onsubmit="Submit(); return false;" action="">
<div class="alert alert-danger text-center d-none p-2" id="info" role="alert"></div>
<div class="mb-3">
<label class="form-label">Username</label>
Expand All @@ -39,7 +39,7 @@
<input class="form-control form-control-lg" type="password" id="password" name="password" placeholder="Enter your password" />
</div>
<div class="d-grid gap-2 mt-3">
<a class="btn btn-lg btn-primary" onclick="Submit();">Log in</a>
<button type="submit" class="btn btn-lg btn-primary" onclick="Submit();">Log in</button>
</div>
</form>
</div>
Expand Down

0 comments on commit 2d902f0

Please sign in to comment.