Fix sshkey
This commit is contained in:
parent
049c0ce221
commit
ec811e437c
|
@ -6,6 +6,7 @@ use experimental 'signatures';
|
||||||
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
use Mojo::Base 'Mojolicious::Controller', -signatures;
|
||||||
use Net::LDAPS;
|
use Net::LDAPS;
|
||||||
use Net::LDAP::Extension::SetPassword;
|
use Net::LDAP::Extension::SetPassword;
|
||||||
|
require unix_dog::Util;
|
||||||
|
|
||||||
sub update_account($self) {
|
sub update_account($self) {
|
||||||
my $v = $self->validation;
|
my $v = $self->validation;
|
||||||
|
@ -28,7 +29,7 @@ sub update_account($self) {
|
||||||
my $loginShell = $self->param('loginShell');
|
my $loginShell = $self->param('loginShell');
|
||||||
my $roomNumber = $self->param('roomNumber');
|
my $roomNumber = $self->param('roomNumber');
|
||||||
my $telNum = $self->param('telNum');
|
my $telNum = $self->param('telNum');
|
||||||
my @sshKeys = Util::split_keys($self->param('sshKeys'));
|
my @sshKeys = unix_dog::Util::split_keys($self->param('sshKeys'));
|
||||||
|
|
||||||
my $curPasswd = $self->param('curPasswd');
|
my $curPasswd = $self->param('curPasswd');
|
||||||
my $newPasswd = $self->param('newPasswd');
|
my $newPasswd = $self->param('newPasswd');
|
||||||
|
@ -76,7 +77,7 @@ sub update_account($self) {
|
||||||
loginShell => $loginShell,
|
loginShell => $loginShell,
|
||||||
roomNumber => $roomNumber || [],
|
roomNumber => $roomNumber || [],
|
||||||
telephoneNumber => $telNum || [],
|
telephoneNumber => $telNum || [],
|
||||||
sshPublicKey => @sshKeys,
|
sshPublicKey => \@sshKeys,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
$mesg->code and die $mesg->error;
|
$mesg->code and die $mesg->error;
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Email::Simple;
|
||||||
use Email::Sender::Simple;
|
use Email::Sender::Simple;
|
||||||
use Email::Sender::Transport::Sendmail;
|
use Email::Sender::Transport::Sendmail;
|
||||||
|
|
||||||
|
|
||||||
sub registration($self) {
|
sub registration($self) {
|
||||||
$self->render('register/registerPage');
|
$self->render('register/registerPage');
|
||||||
}
|
}
|
||||||
|
@ -28,6 +29,7 @@ sub register($self) {
|
||||||
my $password = $self->param('password');
|
my $password = $self->param('password');
|
||||||
my $email = $self->param('email');
|
my $email = $self->param('email');
|
||||||
my $pubkeys = $self->param('pubkey');
|
my $pubkeys = $self->param('pubkey');
|
||||||
|
my @sshKeys = unix_dog::Util::split_keys($pubkeys);
|
||||||
my $bio = $self->param('bio');
|
my $bio = $self->param('bio');
|
||||||
my $fromIP = $self->tx->remote_address;
|
my $fromIP = $self->tx->remote_address;
|
||||||
|
|
||||||
|
@ -99,7 +101,7 @@ sub register($self) {
|
||||||
attrs => [
|
attrs => [
|
||||||
cn => $username,
|
cn => $username,
|
||||||
mail => $username . '@unix.dog',
|
mail => $username . '@unix.dog',
|
||||||
sshPublicKey => Util::split_keys($pubkeys),
|
sshPublicKey => \@sshKeys,
|
||||||
objectClass => [
|
objectClass => [
|
||||||
'top',
|
'top',
|
||||||
'extensibleObject',
|
'extensibleObject',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package Util;
|
package unix_dog::Util;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings FATAL => 'all';
|
use warnings FATAL => 'all';
|
||||||
use experimental 'signatures';
|
use experimental 'signatures';
|
||||||
|
@ -8,5 +8,4 @@ sub split_keys($input) {
|
||||||
@out = grep (defined && length, @out);
|
@out = grep (defined && length, @out);
|
||||||
return @out;
|
return @out;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
Loading…
Reference in New Issue