users: rename "add_user" to "add" and "get_data" to "get"
This commit is contained in:
parent
e98fc8493f
commit
1c63574245
4 changed files with 8 additions and 8 deletions
|
@ -821,7 +821,7 @@ sub startup {
|
||||||
|
|
||||||
$uid //= $self->current_user->{id};
|
$uid //= $self->current_user->{id};
|
||||||
|
|
||||||
return $self->users->get_data( uid => $uid );
|
return $self->users->get( uid => $uid );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ package Travelynx::Command::account;
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
use Mojo::Base 'Mojolicious::Command';
|
use Mojo::Base 'Mojolicious::Command';
|
||||||
use Crypt::Eksblowfish::Bcrypt qw(bcrypt en_base64);
|
use Crypt::Eksblowfish::Bcrypt qw(bcrypt en_base64);
|
||||||
use UUID::Tiny qw(:std);
|
use UUID::Tiny qw(:std);
|
||||||
|
|
||||||
has description => 'Add or remove user accounts';
|
has description => 'Add or remove user accounts';
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ sub add_user {
|
||||||
my $password_hash = hash_password($password);
|
my $password_hash = hash_password($password);
|
||||||
|
|
||||||
my $tx = $db->begin;
|
my $tx = $db->begin;
|
||||||
my $user_id = $self->app->users->add_user(
|
my $user_id = $self->app->users->add(
|
||||||
db => $db,
|
db => $db,
|
||||||
name => $name,
|
name => $name,
|
||||||
email => $email,
|
email => $email,
|
||||||
|
@ -58,7 +58,7 @@ sub add_user {
|
||||||
sub delete_user {
|
sub delete_user {
|
||||||
my ( $self, $uid ) = @_;
|
my ( $self, $uid ) = @_;
|
||||||
|
|
||||||
my $user_data = $self->app->users->get_data( uid => $uid );
|
my $user_data = $self->app->users->get( uid => $uid );
|
||||||
|
|
||||||
if ( not $user_data ) {
|
if ( not $user_data ) {
|
||||||
say "UID $uid does not exist.";
|
say "UID $uid does not exist.";
|
||||||
|
@ -73,7 +73,7 @@ sub delete_user {
|
||||||
sub really_delete_user {
|
sub really_delete_user {
|
||||||
my ( $self, $uid, $name ) = @_;
|
my ( $self, $uid, $name ) = @_;
|
||||||
|
|
||||||
my $user_data = $self->app->users->get_data( uid => $uid );
|
my $user_data = $self->app->users->get( uid => $uid );
|
||||||
|
|
||||||
if ( $user_data->{name} ne $name ) {
|
if ( $user_data->{name} ne $name ) {
|
||||||
say
|
say
|
||||||
|
|
|
@ -337,7 +337,7 @@ sub register {
|
||||||
my $pw_hash = hash_password($password);
|
my $pw_hash = hash_password($password);
|
||||||
my $db = $self->pg->db;
|
my $db = $self->pg->db;
|
||||||
my $tx = $db->begin;
|
my $tx = $db->begin;
|
||||||
my $user_id = $self->users->add_user(
|
my $user_id = $self->users->add(
|
||||||
db => $db,
|
db => $db,
|
||||||
name => $user,
|
name => $user,
|
||||||
email => $email,
|
email => $email,
|
||||||
|
|
|
@ -318,7 +318,7 @@ sub remove_password_token {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_data {
|
sub get {
|
||||||
my ( $self, %opt ) = @_;
|
my ( $self, %opt ) = @_;
|
||||||
my $db = $opt{db} // $self->{pg}->db;
|
my $db = $opt{db} // $self->{pg}->db;
|
||||||
my $uid = $opt{uid};
|
my $uid = $opt{uid};
|
||||||
|
@ -377,7 +377,7 @@ sub get_login_data {
|
||||||
return $res_h;
|
return $res_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub add_user {
|
sub add {
|
||||||
my ( $self, %opt ) = @_;
|
my ( $self, %opt ) = @_;
|
||||||
my $db = $opt{db} // $self->{pg}->db;
|
my $db = $opt{db} // $self->{pg}->db;
|
||||||
my $user_name = $opt{name};
|
my $user_name = $opt{name};
|
||||||
|
|
Loading…
Reference in a new issue