Fix sshkey
This commit is contained in:
parent
7b59847470
commit
049c0ce221
|
@ -28,9 +28,7 @@ sub update_account($self) {
|
|||
my $loginShell = $self->param('loginShell');
|
||||
my $roomNumber = $self->param('roomNumber');
|
||||
my $telNum = $self->param('telNum');
|
||||
my $sshKeys = $self->param('sshKeys');
|
||||
$sshKeys =~ s/\r//;
|
||||
my @sshKeys = split "\n", $sshKeys;
|
||||
my @sshKeys = Util::split_keys($self->param('sshKeys'));
|
||||
|
||||
my $curPasswd = $self->param('curPasswd');
|
||||
my $newPasswd = $self->param('newPasswd');
|
||||
|
@ -44,7 +42,7 @@ sub update_account($self) {
|
|||
loginShell => $loginShell,
|
||||
roomNumber => $roomNumber,
|
||||
telNum => $telNum,
|
||||
sshKeys => join("\n", @sshKeys),
|
||||
sshKeys => join("\r\n", @sshKeys),
|
||||
username => $username,
|
||||
);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ sub register($self) {
|
|||
my $password = $self->param('password');
|
||||
my $email = $self->param('email');
|
||||
my $pubkeys = $self->param('pubkey');
|
||||
$pubkeys =~ s/\r//;
|
||||
my $bio = $self->param('bio');
|
||||
my $fromIP = $self->tx->remote_address;
|
||||
|
||||
|
@ -100,7 +99,7 @@ sub register($self) {
|
|||
attrs => [
|
||||
cn => $username,
|
||||
mail => $username . '@unix.dog',
|
||||
sshPublicKey => (split "\n", $pubkeys),
|
||||
sshPublicKey => Util::split_keys($pubkeys),
|
||||
objectClass => [
|
||||
'top',
|
||||
'extensibleObject',
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package Util;
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use experimental 'signatures';
|
||||
|
||||
sub split_keys($input) {
|
||||
my @out = split /\R/, $input;
|
||||
@out = grep (defined && length, @out);
|
||||
return @out;
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue