diff options
author | Mark Wells <mark@freeside.biz> | 2016-01-12 22:07:17 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2016-01-12 22:07:17 -0800 |
commit | 8c4fb61d3ab13ca97f9fe037555087506435d9da (patch) | |
tree | 29ba945c9bd20cd53c4f1c8b16a550dbaaebfad5 /httemplate/edit/process | |
parent | 992573160bf2fc89b1d957973109e03d2abf0a47 (diff) |
allow svc_acct password field to be disabled, #39528, fixing fallout from #29354 and #32456
Diffstat (limited to 'httemplate/edit/process')
-rwxr-xr-x | httemplate/edit/process/svc_acct.cgi | 31 | ||||
-rw-r--r-- | httemplate/edit/process/svc_dsl.html | 15 |
2 files changed, 36 insertions, 10 deletions
diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 17a035cdb..d81eaecb9 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -76,17 +76,30 @@ if ( $cgi->param('captcha_response') ) { } } -$new->_password($old->_password) if $old; -if ( $cgi->param('clear_password') eq '*HIDDEN*' - || $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) { - die "fatal: no previous account to recall hidden password from!" unless $old; +# check whether the password is set as "fixed" in the service def. if so, +# ignore the password that was submitted and use the fixed value. + +my $psc = $part_svc->part_svc_column('_password'); +if ( $psc->columnflag eq 'F' ) { + + $new->set('_password', $psc->columnvalue); + } else { - my $newpass = $cgi->param('clear_password'); - if ( !$old or ! $old->check_password($newpass) ) { - # then the password is being changed - $error ||= $new->is_password_allowed($newpass) - || $new->set_password($newpass); + + $new->_password($old->_password) if $old; + if ( $cgi->param('clear_password') eq '*HIDDEN*' + || $cgi->param('clear_password') =~ /^\(.* encrypted\)$/ ) { + die "fatal: no previous account to recall hidden password from!" + unless $old; + } else { + my $newpass = $cgi->param('clear_password'); + if ( !$old or ! $old->check_password($newpass) ) { + # then the password is being changed + $error ||= $new->is_password_allowed($newpass) + || $new->set_password($newpass); + } } + } if ( ! $error ) { diff --git a/httemplate/edit/process/svc_dsl.html b/httemplate/edit/process/svc_dsl.html index 889366e07..436ca766b 100644 --- a/httemplate/edit/process/svc_dsl.html +++ b/httemplate/edit/process/svc_dsl.html @@ -12,8 +12,21 @@ my $precheck_callback = sub { my $cgi = shift; my $svcnum = $cgi->param('svcnum'); my $error = ''; + my $old; + my $part_svc; + if ( $svcnum ) { - my $old = FS::svc_dsl->by_key($svcnum); + $old = FS::svc_dsl->by_key($svcnum); + $part_svc = $old->part_svc; + } else { + my $svcpart = $cgi->param('svcpart') or die "svcpart required"; + $part_svc = FS::part_svc->by_key($svcpart); + } + my $psc = $part_svc->part_svc_column('password'); + if ( $psc->columnflag eq 'F' ) { + # enforce it here and skip password validation + $cgi->param('password', $psc->columnvalue; + } else { my $newpass = $cgi->param('password'); if ( $old and $newpass ne $old->password ) { $error ||= $old->is_password_allowed($newpass); |