@@ -470,12 +470,23 @@ def main(client_id, user_arguments_dict, environ=None):
470470 output_objects .append ({'object_type' : 'html_form' , 'text' : helper })
471471 dialog_help = "Really accept account request %s? Optionally provide a specific user as Peer below or %s to auto-extract from request." % (
472472 req_id , keyword_auto )
473- req_item ['createaccountreqlink' ] = {
474- 'object_type' : 'link' , 'destination' :
475- "javascript: confirmDialog(%s, '%s', '%s', '', '%s');" %
476- (js_name , dialog_help , 'request_text' , keyword_auto ),
477- 'class' : 'addlink iconspace' , 'title' : 'Accept request %s' %
478- req_id , 'text' : '' }
473+ reject_reason = keyword_auto
474+ invalid = req_dict .get ('invalid' )
475+ invalid_reasons = '. ' .join (invalid )
476+ if invalid :
477+ reject_reason = invalid_reasons
478+ req_item ['createaccountreqlink' ] = {
479+ 'object_type' : 'link' , 'destination' :
480+ "javascript: alert('invalid request: %s');" % invalid_reasons ,
481+ 'class' : 'warning iconspace' , 'title' : 'Invalid request %s' %
482+ req_id , 'text' : '' }
483+ else :
484+ req_item ['createaccountreqlink' ] = {
485+ 'object_type' : 'link' , 'destination' :
486+ "javascript: confirmDialog(%s, '%s', '%s', '', '%s');" %
487+ (js_name , dialog_help , 'request_text' , keyword_auto ),
488+ 'class' : 'addlink iconspace' , 'title' : 'Accept request %s' %
489+ req_id , 'text' : '' }
479490 # TODO: support checkboxes with notify user and perhaps admin copy
480491 js_name = 'peer%s' % req_id
481492 helper = html_post_helper (js_name , '%s.py' % target_op ,
@@ -501,7 +512,7 @@ def main(client_id, user_arguments_dict, environ=None):
501512 req_item ['rejectaccountreqlink' ] = {
502513 'object_type' : 'link' , 'destination' :
503514 "javascript: confirmDialog(%s, '%s', '%s', '', '%s');" %
504- (js_name , dialog_help , 'request_text' , keyword_auto ),
515+ (js_name , dialog_help , 'request_text' , reject_reason ),
505516 'class' : 'rejectlink iconspace' , 'title' : 'Reject request %s' % req_id ,
506517 'text' : '' }
507518
0 commit comments