12 Commits
0.02 ... 0.04

Author SHA1 Message Date
ziggi
df80f1fa79 autoreconf 2017-12-18 21:20:59 +02:00
ziggi
eb08186dc9 Added getopt 2017-12-18 20:19:51 +02:00
ziggi
cc06e7f39b Added maacom.{dia,png}, generated with autodia 2017-12-16 15:29:13 +02:00
ziggi
59b99644b5 autoreconf 2017-12-15 23:37:23 +02:00
ziggi
dfd6214384 Merge branch 'master' of https://git.unix7.org/maacom 2017-12-15 23:31:30 +02:00
ziggi
09051e496a Added back to list button to handler pages 2017-12-15 23:29:24 +02:00
ziggi
7f93c84d97 Minor changes in README.md 2017-12-15 12:47:59 +02:00
ziggi
d4b474453a Minor changes in README.md 2017-12-15 12:46:59 +02:00
ziggi
c637d26eed Release 0.03 2017-12-15 02:07:51 +02:00
ziggi
21c7463f80 Added quota form/handlers for domain and user 2017-12-15 02:06:38 +02:00
ziggi
e959b27efb Added quota form/handlers for domain and user 2017-12-15 02:03:39 +02:00
ziggi
b5caee2df4 Added quota to form 2017-12-14 23:36:44 +02:00
37 changed files with 6396 additions and 67 deletions

View File

@@ -67,6 +67,8 @@ nobase_dist_pkgdata_DATA = \
templs/domain-add-handler.html.ep \
templs/domain-update-form.html.ep \
templs/domain-update-handler.html.ep \
templs/domain-rename-form.html.ep \
templs/domain-rename-handler.html.ep \
templs/domain-delete-form.html.ep \
templs/domain-delete-handler.html.ep \
\

View File

@@ -330,6 +330,8 @@ nobase_dist_pkgdata_DATA = \
templs/domain-add-handler.html.ep \
templs/domain-update-form.html.ep \
templs/domain-update-handler.html.ep \
templs/domain-rename-form.html.ep \
templs/domain-rename-handler.html.ep \
templs/domain-delete-form.html.ep \
templs/domain-delete-handler.html.ep \
\

View File

@@ -2,22 +2,25 @@
I wrote this application for using into small-middle corporation. I wanted to write a simple classic object-oriented web application, that can be used as a training application.
The application wrote with
### The application wrote with
- Perl Mojolicious as MVC framework and
- Zurb Foundation as CSS
Work example of configuration Exim and Dovecot attached below the page http://wiki.unix7.org/perl/maacom
You can
### You can
- Easy add, delete, rename and edit domain, user and alias records. You can rename entire domain with safe all your accounts!
- Set personal and domain mail quotas (still in progress but already calculates size of mail dirs in background)
- Set personal and domain mail quotas, size of mailbox calculates in background from mail dirs.
- Edit/use additional list of forwarded domain, lists of unwanted and trusted hosts
- Live view tail of mail log from operation system for debugging purpose.
- Configure mail relay and then send a love letter to a loved one =)
Password file in the same Apache htpasswd format.
### Features
- Admin password file in the same Apache htpasswd format.
- Quotas are counted in MB (megabytes).
The application is ready to use, the installation procedure takes 10-15 minutes.
The procedure is described on the project page http://wiki.unix7.org/perl/maacom

22
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for maacom.pl 0.02.
# Generated by GNU Autoconf 2.69 for maacom.pl 0.04.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -576,8 +576,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='maacom.pl'
PACKAGE_TARNAME='maacom-pl'
PACKAGE_VERSION='0.02'
PACKAGE_STRING='maacom.pl 0.02'
PACKAGE_VERSION='0.04'
PACKAGE_STRING='maacom.pl 0.04'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@@ -1234,7 +1234,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures maacom.pl 0.02 to adapt to many kinds of systems.
\`configure' configures maacom.pl 0.04 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1304,7 +1304,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of maacom.pl 0.02:";;
short | recursive ) echo "Configuration of maacom.pl 0.04:";;
esac
cat <<\_ACEOF
@@ -1392,7 +1392,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
maacom.pl configure 0.02
maacom.pl configure 0.04
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1409,7 +1409,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by maacom.pl $as_me 0.02, which was
It was created by maacom.pl $as_me 0.04, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2272,7 +2272,7 @@ fi
# Define the identity of the package.
PACKAGE='maacom-pl'
VERSION='0.02'
VERSION='0.04'
cat >>confdefs.h <<_ACEOF
@@ -3455,7 +3455,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by maacom.pl $as_me 0.02, which was
This file was extended by maacom.pl $as_me 0.04, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -3508,7 +3508,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
maacom.pl config.status 0.02
maacom.pl config.status 0.04
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -4087,5 +4087,3 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi

View File

@@ -1,4 +1,4 @@
AC_INIT(maacom.pl,0.02)
AC_INIT(maacom.pl,0.04)
AM_INIT_AUTOMAKE
AC_PREFIX_DEFAULT(/usr/local)
@@ -244,5 +244,3 @@ init.d/maacom
])
dnl EOF

6031
docs/maacom.dia Normal file

File diff suppressed because it is too large Load Diff

BIN
docs/maacom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

View File

@@ -284,11 +284,13 @@ sub domain_nextid {
}
sub domain_add {
my ($self, $name) = @_;
my ($self, $name, $quota) = @_;
return undef unless $name;
return undef if $self->domain_exist($name);
$quota ||= 1024*1024;
my $next_id = $self->domain_nextid;
$self->db->do("insert into domains (id, name) values ($next_id, '$name')");
$self->db->do("insert into domains (id, name, quota) values ($next_id, '$name', $quota)");
$self->domain_exist($name);
}
@@ -304,8 +306,10 @@ sub domain_update {
return undef unless $prof;
my $name = $args{name} || $prof->{name};
my $quota = $args{quota} || $prof->{quota};
my $quota = $args{quota}*1;
$quota ||= $prof->{quota};
my $size = $prof->{size};
$args{size} ||= -1;
$size = $args{size} if $args{size} >= 0;
$self->db->do("update domains set name = '$name', size = $size, quota = $quota where id = $id");
@@ -467,10 +471,11 @@ sub user_nextid {
}
sub user_add {
my ($self, $name, $password, $domain_id) = @_;
my ($self, $name, $password, $domain_id, $quota) = @_;
return undef unless $name;
return undef unless $password;
return undef unless $domain_id;
$quota ||= 1024*10;
return undef if $self->user_exist($name, $domain_id);
return undef unless $self->domain_profile($domain_id);
@@ -478,8 +483,8 @@ sub user_add {
my $salt = substr(sha512_base64(sprintf("%X", rand(2**31-1))), 4, 16);
my $hash = crypt($password,'$6$'.$salt.'$');
$self->db->do("insert into users (id, name, password, domain_id, hash)
values ($next_id, '$name', '$password', $domain_id, '$hash')");
$self->db->do("insert into users (id, name, password, domain_id, hash, quota)
values ($next_id, '$name', '$password', $domain_id, '$hash', $quota)");
$self->user_exist($name, $domain_id);
}
@@ -907,6 +912,16 @@ sub domain_update_handler {
$self->render(template => 'domain-update-handler');
}
sub domain_rename_form {
my $self = shift;
$self->render(template => 'domain-rename-form');
}
sub domain_rename_handler {
my $self = shift;
$self->render(template => 'domain-rename-handler');
}
sub domain_delete_form {
my $self = shift;
$self->render(template => 'domain-delete-form');
@@ -1142,10 +1157,40 @@ sub startup {
use strict;
use warnings;
use Mojo::Server::Prefork;
use Mojo::Util qw(dumper);
use Mojo::Util qw(dumper getopt);
use File::stat;
my $appname = 'maacom';
#--------------
#--- GETOPT ---
#--------------
getopt
'h|help' => \my $help,
'c|config=s' => \my $conffile,
'f|nofork' => \my $nofork,
'u|user=s' => \my $user,
'g|group=s' => \my $group;
if ($help) {
print qq(
Usage: app [OPTIONS]
Options
-h | --help This help
-c | --config=path Path to config file
-u | --user=user System owner of process
-g | --group=group System group
-f | --nofork Dont fork process
The options override options from configuration file
)."\n";
exit 0;
}
#------------------
#--- APP CONFIG ---
#------------------
my $server = Mojo::Server::Prefork->new;
my $app = $server->build_app('MAM');
@@ -1156,7 +1201,7 @@ $app->secrets(['6d578e43ba88260e0375a1a35fd7954b']);
$app->static->paths(['@app_libdir@/public']);
$app->renderer->paths(['@app_libdir@/templs']);
$app->config(conffile => '@app_confdir@/maacom.conf');
$app->config(conffile => $conffile || '@app_confdir@/maacom.conf');
$app->config(pwfile => '@app_confdir@/maacom.pw');
$app->config(logfile => '@app_logdir@/maacom.log');
$app->config(loglevel => 'info');
@@ -1177,14 +1222,14 @@ $app->config(dblogin => '');
$app->config(dbpassword => '');
$app->config(dbengine => 'sqlite3');
$app->config(group => '@app_group@');
$app->config(user => '@app_user@');
$app->config(group => $group || '@app_group@');
$app->config(user => $user || '@app_user@');
if (-r $app->config('conffile')) {
$app->log->debug("Load configuration from ".$app->config('conffile'));
# $app->plugin('JSONConfig', { file => $app->config('conffile') });
my $c = aConfig->new($app->config('conffile'));
my $hash = $c->read;
foreach my $key (keys %$hash) {
$app->config($key => $hash->{$key});
}
@@ -1247,6 +1292,8 @@ $r->any('/domain/add/form')->over('auth')->to('controller#domain_add_form' );
$r->any('/domain/add/handler')->over('auth')->to('controller#domain_add_handler' );
$r->any('/domain/update/form')->over('auth')->to('controller#domain_update_form' );
$r->any('/domain/update/handler')->over('auth')->to('controller#domain_update_handler' );
$r->any('/domain/rename/form')->over('auth')->to('controller#domain_rename_form' );
$r->any('/domain/rename/handler')->over('auth')->to('controller#domain_rename_handler' );
$r->any('/domain/delete/form')->over('auth')->to('controller#domain_delete_form' );
$r->any('/domain/delete/handler')->over('auth')->to('controller#domain_delete_handler' );
@@ -1328,21 +1375,31 @@ $server->listen(\@listen);
$server->heartbeat_interval(3);
$server->heartbeat_timeout(60);
$server->pid_file($app->config('pidfile'));
$app->log(Mojo::Log->new(
path => $app->config('logfile'),
level => $app->config('loglevel')
));
#--------------
#--- DAEMON ---
#--------------
my $user = $app->config('user');
my $group = $app->config('group');
my $d = Daemon->new($user, $group);
$d->fork;
unless ($nofork) {
my $d = Daemon->new;
my $user = $app->config('user');
my $group = $app->config('group');
$d->fork;
$app->log(Mojo::Log->new(
path => $app->config('logfile'),
level => $app->config('loglevel')
));
}
$server->pid_file($app->config('pidfile'));
#-----------
#--- LOG ---
#-----------
$app->hook(before_dispatch => sub {
my $c = shift;
@@ -1366,6 +1423,9 @@ $app->hook(before_dispatch => sub {
}
});
#--------------
#--- SIGNAL ---
#--------------
# Set signal handler
local $SIG{HUP} = sub {
@@ -1382,7 +1442,7 @@ sub du {
$maxdeep ||= 10;
$deep ||= 0;
my $stat = stat($subj);
return int($stat->size/1024) if -f $subj;
return int($stat->size/(1024*1024)+0.5) if -f $subj;
$deep += 1;
return 0 if $deep > $maxdeep;

View File

@@ -3,7 +3,7 @@ CREATE TABLE domains (
id int unique NOT NULL PRIMARY KEY,
name text unique,
size int DEFAULT 0,
quota int DEFAULT 0
quota int DEFAULT 1048576
);
CREATE TABLE users (
id int unique NOT NULL PRIMARY KEY,
@@ -12,7 +12,7 @@ CREATE TABLE users (
password text,
hash text,
size int DEFAULT 0,
quota int DEFAULT 0
quota int DEFAULT 10240
);
CREATE TABLE aliases (
id int unique NOT NULL PRIMARY KEY,

View File

@@ -28,4 +28,19 @@
<div class="callout alert">Alias <%= $alias_name %> was not added.</div>
% }
% }
% if ($domain_id) {
<a class="float-left button tiny" href="/alias/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($domain_id) {
<a class="float-left button tiny" href="/alias/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF

View File

@@ -14,6 +14,7 @@
% if ($profile) {
% my $name = $profile->{name};
% my $address = $profile->{address};
% my $domain_id = $profile->{domain_id};
% my $res = $u->alias_delete($alias_id);
@@ -24,10 +25,16 @@
% unless ($res) {
<div class="callout alert">Alias <%= $address %> was not deleted</div>
% }
<a class="float-left button tiny" href="/alias/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($profile) {
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
<a class="float-left button tiny" href="/alias/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF

View File

@@ -31,12 +31,17 @@
<div class="callout alert">Alias <%= $address %> was not updated.</div>
% }
% }
<a class="float-left button tiny" href="/alias/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($profile) {
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
<a class="float-left button tiny" href="/alias/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF

View File

@@ -31,10 +31,16 @@
% unless ($res) {
<div class="callout alert">Alias <%= $address %> was not updated.</div>
% }
<a class="float-left button tiny" href="/alias/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($profile) {
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
<div class="callout warning">Alias with id <%= $alias_id %> not exist</div>
<a class="float-left button tiny" href="/alias/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF

View File

@@ -7,6 +7,7 @@
% use Mojo::Util qw(dumper);
% my $u = $c->app->user;
% my $quota = 1024*1024;
<div class="grid-container">
<div class="grid-x grid-padding-x">
@@ -18,6 +19,12 @@
<input type="text" name="domain_name" placeholder="domain.org" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
<span class="form-error">Mandatory, 5 or more letter</span>
</label>
<label>Domain quota
<input type="number" name="quota" value="<%= $quota %>" required pattern="[0-9]{1,15}"/>
<span class="form-error">Mandatory, one or more ciphers</span>
</label>
<div class="text-center">
<button type="submit" class="button">Accept</button>
<a class="button" href="/domain/list">Escape</a>

View File

@@ -9,13 +9,14 @@
% my $u = $c->app->user;
% my $name = $c->req->param('domain_name');
% my $id = $u->domain_exist($name);
% my $quota = $c->req->param('quota') || 0;
% if ($id) {
<div class="callout warning">Domain <%= $name %> already exists</div>
% }
% unless ($id) {
% my $res = $u->domain_add($name);
% my $res = $u->domain_add($name, $quota);
% if ($res) {
<div class="callout success">Domain <%= $name %> has been added.</div>
% }
@@ -25,6 +26,10 @@
% }
% }
<a class="float-left button tiny" href="/domain/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -28,5 +28,9 @@
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
% }
<a class="float-left button tiny" href="/domain/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -30,8 +30,10 @@
<th>#</th>
<th>domain</th>
<th><i class="fi-graph-pie"></i></th>
<th><i class="fi-alert"></i></th>
<th><i class="fi-male"></i></th>
<th><i class="fi-male-female"></i></th>
<th><i class="fi-address-book"></i></th>
<th><i class="fi-pencil"></i></th>
<th><i class="fi-trash"></i></th>
</tr>
@@ -45,12 +47,15 @@
% my $id = $row->{id};
% my $name = $row->{name};
% my $size = $row->{size};
% my $quota = $row->{quota};
<tr>
<td><%= $n %></td>
<td><%= $name %></td>
<td><%= $size %></td>
<td><%= $quota %></td>
<td><a href="/user/list?domain_id=<%= $id %>"><%= $u->domain_user_count($id) %></a></td>
<td><a href="/alias/list?domain_id=<%= $id %>"><%= $u->domain_alias_count($id) %></a></td>
<td><a href="/domain/rename/form?domain_id=<%= $id %>"><i class="fi-address-book"></i></a></td>
<td><a href="/domain/update/form?domain_id=<%= $id %>"><i class="fi-pencil"></i></a></td>
<td><a href="/domain/delete/form?domain_id=<%= $id %>"><i class="fi-trash"></i></a></td>
</tr>

View File

@@ -0,0 +1,44 @@
%#
%# $Id$
%#
% layout 'default';
% title 'Maacom';
% use Mojo::Util qw(dumper);
% my $u = $c->app->user;
% my $domain_id = $c->req->param('domain_id') || 0;
% my $profile = $u->domain_profile($domain_id);
% if ($profile) {
% my $domain_name = $profile->{name};
<div class="grid-container">
<div class="grid-x grid-padding-x">
<div class="medium-6 medium-centered cell">
<form accept-charset="UTF-8" action="/domain/rename/handler" method="post" data-abide novalidate>
<h5 class="text-center">Edit domain</h5>
<input type="hidden" name="domain_id" value="<%= $domain_id %>"/>
<label>Domain name
<input type="text" value="<%= $domain_name %>" name="domain_name" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
<span class="form-error">Mandatory, 5 or more letter</span>
</label>
<div class="text-center">
<button type="submit" class="button">Accept</button>
<a class="button" href="/domain/list">Escape</a>
</div>
</form>
</div>
</div>
</div>
% }
% unless ($profile) {
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
% }
%#EOF

View File

@@ -0,0 +1,46 @@
%#
%# $Id$
%#
% layout 'default';
% title 'Maacom';
% use Mojo::Util qw(dumper);
% my $u = $c->app->user;
% my $new_name = $c->req->param('domain_name');
% my $domain_id = $c->req->param('domain_id') || 0;
% my $profile = $u->domain_profile($domain_id);
% if ($profile) {
% my $name = $profile->{name};
% my $cid = $u->domain_exist($new_name);
% if ($cid) {
<div class="callout warning">Domain <%= $new_name %> already exists, domain name <%= $name %> was not changed.</div>
% }
% unless ($cid) {
% my $res = $u->domain_update($domain_id, name => $new_name);
% if ($res) {
<div class="callout success">Domain <%= $name %> has been renamed to <%= $new_name %>.</div>
% }
% unless ($res) {
<div class="callout alert">Domain <%= $name %> was not updated.</div>
% }
% }
% }
% unless ($profile) {
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
% }
<a class="float-left button tiny" href="/domain/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -13,6 +13,7 @@
% if ($profile) {
% my $domain_name = $profile->{name};
% my $quota = $profile->{quota} || 0;
<div class="grid-container">
<div class="grid-x grid-padding-x">
@@ -21,9 +22,9 @@
<form accept-charset="UTF-8" action="/domain/update/handler" method="post" data-abide novalidate>
<h5 class="text-center">Edit domain</h5>
<input type="hidden" name="domain_id" value="<%= $domain_id %>"/>
<label>Domain name
<input type="text" value="<%= $domain_name %>" name="domain_name" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
<span class="form-error">Mandatory, 5 or more letter</span>
<label>Quota
<input type="number" name="quota" value="<%= $quota %>" required pattern="[0-9]{1,15}"/>
<span class="form-error">Mandatory, one or more ciphers</span>
</label>
<div class="text-center">
<button type="submit" class="button">Accept</button>

View File

@@ -8,25 +8,19 @@
% my $u = $c->app->user;
% my $name = $c->req->param('domain_name');
% my $domain_id = $c->req->param('domain_id') || 0;
% my $profile = $u->domain_profile($domain_id);
% my $quota = $c->req->param('quota') || $profile->{quota};
% if ($profile) {
% my $cid = $u->domain_exist($name);
% if ($cid) {
<div class="callout warning">Domain <%= $name %> already exists</div>
% my $name = $profile->{name};
% my $res = $u->domain_update($domain_id, quota => $quota);
% if ($res) {
<div class="callout success">Domain <%= $name %> has been updated.</div>
% }
% unless ($cid) {
% my $res = $u->domain_update($domain_id, name => $name);
% if ($res) {
<div class="callout success">Domain <%= $name %> has been updated.</div>
% }
% unless ($res) {
<div class="callout alert">Domain <%= $name %> was not updated.</div>
% }
% unless ($res) {
<div class="callout alert">Domain <%= $name %> was not updated.</div>
% }
% }
@@ -34,6 +28,9 @@
<div class="callout warning">Domain with id <%= $domain_id %> not exist</div>
% }
<a class="float-left button tiny" href="/domain/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -25,6 +25,9 @@
% }
% }
<a class="float-left button tiny" href="/forwarded/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -28,5 +28,9 @@
<div class="callout warning">Domain with id <%= $forwarded_id %> not exist</div>
% }
<a class="float-left button tiny" href="/forwarded/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -34,6 +34,9 @@
<div class="callout warning">Domain with id <%= $forwarded_id %> not exist</div>
% }
<a class="float-left button tiny" href="/forwarded/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -25,6 +25,10 @@
% }
% }
<a class="float-left button tiny" href="/trusted/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -28,5 +28,9 @@
<div class="callout warning">Host with id <%= $trusted_id %> not exist</div>
% }
<a class="float-left button tiny" href="/trusted/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -34,6 +34,10 @@
<div class="callout warning">Host with id <%= $trusted_id %> not exist</div>
% }
<a class="float-left button tiny" href="/trusted/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -25,6 +25,10 @@
% }
% }
<a class="float-left button tiny" href="/unwanted/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -28,5 +28,9 @@
<div class="callout warning">Host with id <%= $unwanted_id %> not exist</div>
% }
<a class="float-left button tiny" href="/unwanted/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -34,6 +34,10 @@
<div class="callout warning">Host with id <%= $unwanted_id %> not exist</div>
% }
<a class="float-left button tiny" href="/unwanted/list">
<i class="fi-arrow-left"></i>
</a>
%#EOF

View File

@@ -9,6 +9,7 @@
% my $u = $c->app->user;
% my $domain_id = $c->req->param('domain_id');
% my $quota = 1024*10;
% if ($domain_id) {
% my $profile = $u->domain_profile($domain_id);
@@ -28,6 +29,12 @@
<input type="text" name="password" placeholder="xxxxxxxxx" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{5,42}"/>
<span class="form-error">Mandatory, 6 or more letter</span>
</label>
<label>Quota
<input type="number" name="quota" value="<%= $quota %>" required pattern="[0-9]{1,15}"/>
<span class="form-error">Mandatory, one or more ciphers</span>
</label>
<div class="text-center">
<button type="submit" class="button">Accept</button>
<a class="button" href="/user/list?domain_id=<%= $domain_id %>">Escape</a>
@@ -63,6 +70,10 @@
% }
</select >
</label>
<label>Quota
<input type="number" name="quota" value="<%= $quota %>" required pattern="[0-9]{1,15}"/>
<span class="form-error">Mandatory, one or more ciphers</span>
</label>
<div class="text-center">
<button type="submit" class="button">Accept</button>

View File

@@ -11,6 +11,8 @@
% my $user_name = $c->req->param('user_name');
% my $domain_id = $c->req->param('domain_id');
% my $password = $c->req->param('password');
% my $quota = $c->req->param('quota');
% my $cid = $u->user_exist($user_name, $domain_id);
@@ -19,7 +21,7 @@
% }
% unless ($cid) {
% my $id = $u->user_add($user_name, $password, $domain_id);
% my $id = $u->user_add($user_name, $password, $domain_id, $quota);
% if ($id) {
<div class="callout success">User <%= $user_name %> has been added.</div>
% }
@@ -28,6 +30,20 @@
<div class="callout alert">User <%= $user_name %> was not added.</div>
% }
% }
% if ($domain_id) {
<a class="float-left button tiny" href="/user/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($domain_id) {
<a class="float-left button tiny" href="/user/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF

View File

@@ -14,6 +14,7 @@
% if ($profile) {
% my $name = $profile->{name};
% my $address = $profile->{address};
% my $domain_id = $profile->{domain_id};
% my $res = $u->user_delete($user_id);
@@ -24,11 +25,16 @@
% unless ($res) {
<div class="callout alert">User <%= $address %> was not deleted</div>
% }
<a class="float-left button tiny" href="/user/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($profile) {
<div class="callout warning">User with id <%= $user_id %> not exist</div>
<div class="callout warning">User with id <%= $user_id %> not exist</div>
<a class="float-left button tiny" href="/user/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF

View File

@@ -28,6 +28,7 @@
<th>#</th>
<th>address</th>
<th><i class="fi-graph-pie"></i></th>
<th><i class="fi-alert"></i></th>
<th><i class="fi-address-book"></i></th>
<th><i class="fi-pencil"></i></th>
<th><i class="fi-trash"></i></th>
@@ -42,10 +43,12 @@
% my $user_id = $row->{id};
% my $domain_id = $row->{domain_id};
% my $size = $row->{size} || 0;
% my $quota = $row->{quota} || 0;
<tr>
<td><%= $n %></td>
<td><%= $address %></td>
<td><%= $size %></td>
<td><%= $quota %></td>
<td><a href="/user/rename/form?user_id=<%= $user_id %>"><i class="fi-address-book"></i></a></td>
<td><a href="/user/update/form?user_id=<%= $user_id %>"><i class="fi-pencil"></i></a></td>
<td><a href="/user/delete/form?user_id=<%= $user_id %>"><i class="fi-trash"></i></a></td>
@@ -72,6 +75,7 @@
<th>#</th>
<th>address</th>
<th><i class="fi-graph-pie"></i></th>
<th><i class="fi-alert"></i></th>
<th><i class="fi-at-sign"></i></th>
<th><i class="fi-address-book"></i></th>
<th><i class="fi-pencil"></i></th>
@@ -87,10 +91,12 @@
% my $user_id = $row->{id};
% my $domain_id = $row->{domain_id};
% my $size = $row->{size} || 0;
% my $quota = $row->{quota} || 0;
<tr>
<td><%= $n %></td>
<td><%= $address %></td>
<td><%= $size %></td>
<td><%= $quota %></td>
<td><a href="/user/list?domain_id=<%= $domain_id %>"><i class="fi-at-sign"></i></a></td>
<td><a href="/user/rename/form?user_id=<%= $user_id %>"><i class="fi-address-book"></i></a></td>
<td><a href="/user/update/form?user_id=<%= $user_id %>"><i class="fi-pencil"></i></a></td>

View File

@@ -32,10 +32,16 @@
<div class="callout alert">User <%= $address %> was not updated.</div>
% }
% }
<a class="float-left button tiny" href="/user/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($profile) {
<div class="callout warning">User with id <%= $user_id %> not exist</div>
<div class="callout warning">User with id <%= $user_id %> not exist</div>
<a class="float-left button tiny" href="/user/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF

View File

@@ -17,6 +17,7 @@
% my $domain_id = $profile->{domain_id};
% my $password = $profile->{password};
% my $address = $profile->{address};
% my $quota = $profile->{quota};
<div class="grid-container">
<div class="grid-x grid-padding-x">
@@ -29,6 +30,11 @@
<input type="text" value="<%= $password %>" name="password" required pattern="[_.-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{6,42}"/>
<span class="form-error">Mandatory, 6 or more letter</span>
</label>
<label>Quota
<input type="number" name="quota" value="<%= $quota %>" required pattern="[0-9]{1,15}"/>
<span class="form-error">Mandatory, one or more ciphers</span>
</label>
<div class="text-center">
<button type="submit" class="button">Accept</button>
<a class="button" href="/user/list?">Escape</a>

View File

@@ -10,6 +10,7 @@
% my $user_id = $c->req->param('user_id') || 0;
% my $password = $c->req->param('password');
% my $quota = $c->req->param('quota');
% my $profile = $u->user_profile($user_id);
@@ -17,18 +18,25 @@
% my $domain_id = $profile->{domain_id};
% my $domain_name = $profile->{domain_name};
% my $address = $profile->{address};
% my $quota = $quota || $profile->{quota};
% my $res = $u->user_update($user_id, password => $password);
% my $res = $u->user_update($user_id, password => $password, quota => $quota);
% if ($res) {
<div class="callout success">User <%= $address %> has been updated.</div>
% }
% unless ($res) {
<div class="callout alert">User <%= $address %> was not updated.</div>
% }
<a class="float-left button tiny" href="/user/list?domain_id=<%= $domain_id %>">
<i class="fi-arrow-left"></i>
</a>
% }
% unless ($profile) {
<div class="callout warning">User with id <%= $user_id %> not exist</div>
<div class="callout warning">User with id <%= $user_id %> not exist</div>
<a class="float-left button tiny" href="/user/list">
<i class="fi-arrow-left"></i>
</a>
% }
%#EOF