summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB/AM.pm16
-rwxr-xr-xbin/am.pl2
2 files changed, 16 insertions, 2 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm
index 95b2a075..b3e94bbb 100755
--- a/LedgerSMB/AM.pm
+++ b/LedgerSMB/AM.pm
@@ -1311,9 +1311,23 @@ sub save_preferences {
# connect to database
my $dbh = $form->{dbh};
+
+ # get username, is same as requested?
my @queryargs;
- # update name
my $query = qq|
+ SELECT login
+ FROM employee
+ WHERE login = ?|;
+ @queryargs = ($form->{login});
+ my $sth = $dbh->prepare($query);
+ $sth->execute(@queryargs) || $form->dberror($query);
+ my ($dbusername) = $sth->fetchrow_array;
+ $sth->finish;
+
+ return 0 if ($dbusername ne $form->{login});
+
+ # update name
+ $query = qq|
UPDATE employee
SET name = ?,
role = ?
diff --git a/bin/am.pl b/bin/am.pl
index e388c6a8..b742c04a 100755
--- a/bin/am.pl
+++ b/bin/am.pl
@@ -2235,7 +2235,7 @@ sub save_preferences {
}
if (AM->save_preferences(\%myconfig, \%$form)) {
- $form->redirect($locale->text('Preferences saved!'));
+ $form->info($locale->text('Preferences saved!'));
} else {
$form->error($locale->text('Cannot save preferences!'));
}