summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-01-22 12:44:19 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-01-22 12:44:19 +0100
commit1c63574245bd309c879c8f2914dfec9d67a48486 (patch)
treebb2778d781c5d5db4a330b2787c12fc50c108cbc /lib
parente98fc8493fee2135b8ff3a33521969d7d79a2988 (diff)
users: rename "add_user" to "add" and "get_data" to "get"
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx.pm2
-rw-r--r--lib/Travelynx/Command/account.pm8
-rw-r--r--lib/Travelynx/Controller/Account.pm2
-rw-r--r--lib/Travelynx/Model/Users.pm4
4 files changed, 8 insertions, 8 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 1d0f1f2..c4f6bca 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -821,7 +821,7 @@ sub startup {
$uid //= $self->current_user->{id};
- return $self->users->get_data( uid => $uid );
+ return $self->users->get( uid => $uid );
}
);
diff --git a/lib/Travelynx/Command/account.pm b/lib/Travelynx/Command/account.pm
index 6cd3498..1cd58bd 100644
--- a/lib/Travelynx/Command/account.pm
+++ b/lib/Travelynx/Command/account.pm
@@ -5,7 +5,7 @@ package Travelynx::Command::account;
# SPDX-License-Identifier: AGPL-3.0-or-later
use Mojo::Base 'Mojolicious::Command';
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';
@@ -34,7 +34,7 @@ sub add_user {
my $password_hash = hash_password($password);
my $tx = $db->begin;
- my $user_id = $self->app->users->add_user(
+ my $user_id = $self->app->users->add(
db => $db,
name => $name,
email => $email,
@@ -58,7 +58,7 @@ sub add_user {
sub delete_user {
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 ) {
say "UID $uid does not exist.";
@@ -73,7 +73,7 @@ sub delete_user {
sub really_delete_user {
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 ) {
say
diff --git a/lib/Travelynx/Controller/Account.pm b/lib/Travelynx/Controller/Account.pm
index 2d9a1ce..755ac7d 100644
--- a/lib/Travelynx/Controller/Account.pm
+++ b/lib/Travelynx/Controller/Account.pm
@@ -337,7 +337,7 @@ sub register {
my $pw_hash = hash_password($password);
my $db = $self->pg->db;
my $tx = $db->begin;
- my $user_id = $self->users->add_user(
+ my $user_id = $self->users->add(
db => $db,
name => $user,
email => $email,
diff --git a/lib/Travelynx/Model/Users.pm b/lib/Travelynx/Model/Users.pm
index 46ffbdd..c162f30 100644
--- a/lib/Travelynx/Model/Users.pm
+++ b/lib/Travelynx/Model/Users.pm
@@ -318,7 +318,7 @@ sub remove_password_token {
);
}
-sub get_data {
+sub get {
my ( $self, %opt ) = @_;
my $db = $opt{db} // $self->{pg}->db;
my $uid = $opt{uid};
@@ -377,7 +377,7 @@ sub get_login_data {
return $res_h;
}
-sub add_user {
+sub add {
my ( $self, %opt ) = @_;
my $db = $opt{db} // $self->{pg}->db;
my $user_name = $opt{name};