Skip to content

Commit

Permalink
Add passwordless mode that supports SIP and regular logins #291
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemhall committed Mar 31, 2023
1 parent abd730b commit 05d536f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
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
10 changes: 10 additions & 0 deletions root/dynamic/templates/administration/settings/index.tt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,16 @@
</div>
</fieldset>

<fieldset>
<legend>[% c.loc("Client 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

0 comments on commit 05d536f

Please sign in to comment.