From 97316d268e5751a1d08a0a37e5a0456f2ce4815c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Aug 2006 10:47:18 +0000 Subject: self-service interface: add proper password changer and prevent "Setup my services" provisioner from showing broken links for services not handled yet --- .../FS-SelfService/cgi/change_password.html | 53 ++++++++++++++++++++++ .../FS-SelfService/cgi/myaccount_menu.html | 10 ++-- .../cgi/process_change_password.html | 13 ++++++ .../FS-SelfService/cgi/provision_list.html | 5 +- fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 38 +++++++++++++++- 5 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 fs_selfservice/FS-SelfService/cgi/change_password.html create mode 100644 fs_selfservice/FS-SelfService/cgi/process_change_password.html (limited to 'fs_selfservice/FS-SelfService/cgi') diff --git a/fs_selfservice/FS-SelfService/cgi/change_password.html b/fs_selfservice/FS-SelfService/cgi/change_password.html new file mode 100644 index 000000000..af7b45313 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/change_password.html @@ -0,0 +1,53 @@ +MyAccount +MyAccount

+<%= $url = "$selfurl?session=$session_id;action="; ''; %> +<%= include('myaccount_menu') %> + + +Change password

+ +<%= if ( $error ) { + $OUT .= qq!$error

!; +} ''; %> + +
+ + + + + + + + + + + + + + + + + + + + +
Change password for account: + +
New password:
Re-enter new password:
+
+ + + +
+ + +
+powered by freeside + diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html index f2e5e998e..aa22e7c9b 100644 --- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html +++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html @@ -35,9 +35,9 @@ push @menu, ( { title=>' ' }, { title=>'Change my information', size=>'+1', }, - { title=>'Change payment information*', url=>'change_bill', indent=>2 }, - { title=>'Change service address*', url=>'change_ship', indent=>2 }, - { title=>'Change password(s)*', url=>'hmmmFIXME', indent=>2 }, + { title=>'Change payment information*', url=>'change_bill', indent=>2 }, + { title=>'Change service address*', url=>'change_ship', indent=>2 }, + { title=>'Change password(s)', url=>'change_password', indent=>2 }, { title=>' ' }, @@ -82,8 +82,8 @@ foreach my $item ( @menu ) { %> +

* coming soon + -(tempFIXME) Change password(s)

-* coming soon diff --git a/fs_selfservice/FS-SelfService/cgi/process_change_password.html b/fs_selfservice/FS-SelfService/cgi/process_change_password.html new file mode 100644 index 000000000..4fdee79f3 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/process_change_password.html @@ -0,0 +1,13 @@ +MyAccount +MyAccount

+<%= $url = "$selfurl?session=$session_id;action="; ''; %> +<%= include('myaccount_menu') %> + + +Password changed for <%= $value %> <%= $label %>. + + +
+powered by freeside + + diff --git a/fs_selfservice/FS-SelfService/cgi/provision_list.html b/fs_selfservice/FS-SelfService/cgi/provision_list.html index 0f68dfe3c..cd587f072 100644 --- a/fs_selfservice/FS-SelfService/cgi/provision_list.html +++ b/fs_selfservice/FS-SelfService/cgi/provision_list.html @@ -75,7 +75,10 @@ function areyousure(href, message) { $OUT .= "$td COLSPAN=3 ALIGN=center>". qq!!. 'Setup '. $part_svc->{'svc'}. ' '. '('. $part_svc->{'num_avail'}. ' available)'. - ''; + '' + #self-service only supports these services so far + if grep { $part_svc->{'svcdb'} eq $_ } qw( svc_acct svc_external ); + $col = $col eq $col1 ? $col2 : $col1; } diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index 034a684c6..4ab13090f 100644 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -13,6 +13,7 @@ use FS::SelfService qw( login customer_info invoice list_pkgs part_svc_info provision_acct provision_external unprovision_svc + list_svcs myaccount_passwd ); $template_dir = '.'; @@ -62,7 +63,7 @@ $session_id = $cgi->param('session'); #order|pw_list XXX ??? $cgi->param('action') =~ - /^(myaccount|view_invoice|make_payment|payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc)$/ + /^(myaccount|view_invoice|make_payment|payment_results|recharge_prepay|recharge_results|logout|change_bill|change_ship|provision|provision_svc|process_svc_acct|process_svc_external|delete_svc|change_password|process_change_password)$/ or die "unknown action ". $cgi->param('action'); my $action = $1; @@ -257,6 +258,41 @@ sub delete_svc { ); } +sub change_password { + list_svcs( + 'session_id' => $session_id, + 'svcdb' => 'svc_acct', + ); +}; + +sub process_change_password { + + my $result = myaccount_passwd( + 'session_id' => $session_id, + map { $_ => $cgi->param($_) } qw( svcnum new_password new_password2 ) + ); + + if ( exists $result->{'error'} && $result->{'error'} ) { + + $action = 'change_password'; + return { + $cgi->Vars, + %{ list_svcs( 'session_id' => $session_id, + 'svcdb' => 'svc_acct', + ) + }, + #'svcnum' => $cgi->param('svcnum'), + 'error' => $result->{'error'} + }; + + } else { + + return $result; + + } + +} + #-- sub do_template { -- cgit v1.2.1