default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / edit / process / svc_dsl.html
1 <% include( 'elements/svc_Common.html',
2                'table'    => 'svc_dsl',
3                'precheck_callback' => $precheck_callback,
4            )
5 %>
6 <%init>
7
8 die "access denied"
9   unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
10
11 my $precheck_callback = sub {
12   my $cgi = shift;
13   my $svcnum = $cgi->param('svcnum');
14   my $error = '';
15   my $old;
16   my $part_svc;
17
18   if ( $svcnum ) {
19     $old = FS::svc_dsl->by_key($svcnum);
20     $part_svc = $old->part_svc;
21   } else {
22     my $svcpart = $cgi->param('svcpart') or die "svcpart required";
23     $part_svc = FS::part_svc->by_key($svcpart);
24   }
25   my $psc = $part_svc->part_svc_column('password');
26   if ( $psc->columnflag eq 'F' ) {
27     # enforce it here and skip password validation
28     $cgi->param('password', $psc->columnvalue);
29   } else {
30     my $newpass = $cgi->param('password');
31     if ( $old and $newpass ne $old->password ) {
32       $error ||= $old->is_password_allowed($newpass);
33     }
34   }
35   $error;
36 };
37
38 </%init>