Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add passwordless mode that supports SIP and regular logins #292

Merged
merged 2 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [4.6.0] [r23.04]
### Added
- Add passwordless mode that supports SIP and regular logins

## [4.5.0] [r23.03]
### Added
- Add basic prometheus metrics for counting sessions, clients and logins ( in addition to default metrics )
- Add ability to set client logo URL, height and width from the server
Expand Down
4 changes: 2 additions & 2 deletions lib/Libki.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use DateTime::Format::MySQL;
use DateTime;
use File::Slurp;

our $VERSION = '4.4.0';
our $VERSION = '4.5.0';

# Set flags and add plugins for the application.
#
Expand Down Expand Up @@ -40,7 +40,7 @@ use Catalyst qw(
Session::State::Cookie

StatusMessage

Breadcrumbs
LibkiSetting

Expand Down
6 changes: 5 additions & 1 deletion lib/Libki/Controller/API/Client/v1_0.pm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ sub index : Path : Args(0) {
status => $client->status,
ClientBehavior => $c->stash->{Settings}->{ClientBehavior},
ReservationShowUsername => $c->stash->{Settings}->{ReservationShowUsername},
EnableClientSessionLocking => $c->stash->{Settings}->{EnableClientSessionLocking},

EnableClientSessionLocking => $c->stash->{Settings}->{EnableClientSessionLocking},
EnableClientPasswordlessMode => $c->stash->{Settings}->{EnableClientPasswordlessMode},

TermsOfService => decode( 'UTF-8', $c->stash->{Settings}->{TermsOfService} ),
TermsOfServiceDetails => decode( 'UTF-8', $c->stash->{Settings}->{TermsOfServiceDetails} ),

Expand Down Expand Up @@ -247,6 +250,7 @@ sub index : Path : Args(0) {
## Process client requests
if ($success) {
if (
$c->setting('EnableClientPasswordlessMode') ||
$c->authenticate(
{
username => $username,
Expand Down
2 changes: 1 addition & 1 deletion lib/Libki/Controller/Administration/Settings.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ sub update :Local :Args(0) {
}

# Checkboxes need to be converted to boolean values
foreach my $pref ( qw( EnableClientSessionLocking TimeAllowanceByLocation ) ) {
foreach my $pref ( qw( EnableClientSessionLocking TimeAllowanceByLocation EnableClientPasswordlessMode ) ) {
$c->model('DB::Setting')->update_or_create(
{
instance => $instance,
Expand Down
2 changes: 1 addition & 1 deletion lib/Libki/SIP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ sub authenticate_via_sip {

$log->debug("ILS verifies $username exists");

unless ( $config->{SIP}->{no_password_check} || $admin_auth ) {
unless ( $c->setting('EnableClientPasswordlessMode') || $config->{SIP}->{no_password_check} || $admin_auth ) {
if ( CORE::index( $data, 'CQY' ) == -1 ) {
return {
success => 0,
Expand Down
24 changes: 17 additions & 7 deletions root/dynamic/templates/administration/settings/index.tt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
<legend>[% c.loc("Client behavior") %]</legend>

<div class="form-group">
<label for="ClientBehavior">[% c.loc("Client reservations") %]</label>
<label for="ClientBehavior">[% c.loc("Reservations") %]</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="ClientBehavior" id="ClientBehaviorFCFS" value="FCFS" [% IF ClientBehavior == 'FCFS' %]checked[% END %]>
<label class="form-check-label" for="ClientBehaviorFCFS">
Expand All @@ -204,10 +204,10 @@
</fieldset>

<fieldset>
<legend>[% c.loc("Client notifications") %]</legend>
<legend>[% c.loc("Notifications") %]</legend>

<div class="form-group">
<label for="ClientTimeNotificationFrequency">[% c.loc("Client time notification frequency") %]</label>
<label for="ClientTimeNotificationFrequency">[% c.loc("Time notification frequency") %]</label>
<div class="input-group">
<input type="text" class="form-control" id="ClientTimeNotificationFrequency" name="ClientTimeNotificationFrequency" value="[% ClientTimeNotificationFrequency %]">
<div class="input-group-append">
Expand All @@ -219,7 +219,7 @@
</div>

<div class="form-group">
<label for="ClientTimeWarningThreshold">[% c.loc("Client time warning threshold") %]</label>
<label for="ClientTimeWarningThreshold">[% c.loc("Time warning threshold") %]</label>
<div class="input-group">
<input type="text" class="form-control" id="ClientTimeWarningThreshold" name="ClientTimeWarningThreshold" value="[% ClientTimeWarningThreshold %]">
<div class="input-group-append">
Expand All @@ -235,7 +235,7 @@
<legend>[% c.loc("Client inactivity") %]</legend>

<div class="form-group">
<label for="ClientInactivityWarning">[% c.loc("Client inactivity warning") %]</label>
<label for="ClientInactivityWarning">[% c.loc("Inactivity warning") %]</label>
<div class="input-group">
<input type="text" class="form-control" id="ClientInactivityWarning" name="ClientInactivityWarning" value="[% ClientInactivityWarning %]">
<div class="input-group-append">
Expand All @@ -247,7 +247,7 @@
</div>

<div class="form-group">
<label for="ClientInactivityLogout">[% c.loc("Client inactivity logout") %]</label>
<label for="ClientInactivityLogout">[% c.loc("Inactivity logout") %]</label>
<div class="input-group">
<input type="text" class="form-control" id="ClientInactivityLogout" name="ClientInactivityLogout" value="[% ClientInactivityLogout %]">
<div class="input-group-append">
Expand All @@ -259,7 +259,7 @@
</fieldset>

<fieldset>
<legend>[% c.loc("Client session pausing") %]</legend>
<legend>[% c.loc("Session pausing") %]</legend>

<div class="form-group">
<input id="EnableClientSessionLocking" name="EnableClientSessionLocking" type="checkbox" [% IF EnableClientSessionLocking %]checked="checked"[% END %]>
Expand All @@ -268,6 +268,16 @@
</div>
</fieldset>

<fieldset>
<legend>[% c.loc("Passwordless mode") %]</legend>

<div class="form-group">
<input id="EnableClientPasswordlessMode" name="EnableClientPasswordlessMode" type="checkbox" [% IF EnableClientPasswordlessMode %]checked="checked"[% END %]>
<label for="EnableClientPasswordlessMode">[% c.loc("Enable passwordless mode for clients") %]</label>
<small class="form-text text-muted">[% c.loc("If enabled, passwords will not be checked for client logins and the password field will be hidden in client v2.2.22 or later.") %]</small>
</div>
</fieldset>

<fieldset>
<legend>[% c.loc("Client registration") %]</legend>

Expand Down