- if (defined $user || defined $ipaddr) {
- my $u=encode_utf8(defined $user ? $user : $ipaddr);
- $ENV{GIT_AUTHOR_NAME}=$u;
- $ENV{GIT_AUTHOR_EMAIL}="$u\@web";
+
+ if (defined $params{session}) {
+ # Set the commit author and email based on web session info.
+ my $u;
+ if (defined $params{session}->param("name")) {
+ $u=$params{session}->param("name");
+ }
+ elsif (defined $params{session}->remote_addr()) {
+ $u=$params{session}->remote_addr();
+ }
+ if (defined $u) {
+ $u=encode_utf8($u);
+ $ENV{GIT_AUTHOR_NAME}=$u;
+ }
+ if (defined $params{session}->param("nickname")) {
+ $u=encode_utf8($params{session}->param("nickname"));
+ $u=~s/\s+/_/g;
+ $u=~s/[^-_0-9[:alnum:]]+//g;
+ }
+ if (defined $u) {
+ $ENV{GIT_AUTHOR_EMAIL}="$u\@web";
+ }