[% USE SSL; CPANEL.CPVAR.dprefix = '../'; # Process the upload key # - Pass the whole FORM is, as the upload functionality has possibly dynamic key names IF FORM.type == 'paste'; SET upload_key = execute('SSL', 'upload_key', { key => RAW_FORM('key'), friendly_name => RAW_FORM('fname') } ); ELSE; SET upload_key = execute('SSL', 'upload_key', RAW_FORM ); END; SET ref = FORM.ref || ''; SET safe_id = upload_key.data.0.id.html(); SET safe_name = upload_key.data.0.friendly_name.html(); # Find the name of the file from the FORM parameters # The file name is contained as part of the parameter # starting with "file-" and ending in "-key". Extracting # everything between is the name of the uploaded file. # Technically this form can upload multiple keys, but # in practicality, the source page for does not provide # this capability, so this only retrieve the first file # name. FOREACH a_key IN FORM.keys; SET matches = a_key.match('^file-(.*)-key$'); IF matches; SET safe_file_name = matches.0.html(); END; LAST IF matches; END; SET show_unified_ssl = SSL.should_show_unified_ssl_ui(); %] [% WRAPPER '_assets/master.html.tt' app_key = 'ssl_tls' page_title = show_unified_ssl ? locale.maketext('SSL/TLS Certificates') : '' embed_stylesheets = ["css/ssl.css"] -%] [% PROCESS '_assets/_ssl_tls_tabs.html.tt' active_tab = '' %]
[% IF show_unified_ssl %] [% IF FORM.type == 'paste' %] [% INCLUDE _assets/_ssl_tls_tabs_breadcrumb.html.tt parent_location_text=locale.maketext('Keys') current_location_text=locale.maketext('Upload Key') go_back_location='keys.html' go_back_link_text=locale.maketext('Go Back') %] [% ELSIF FORM.type == 'upload' %] [% INCLUDE _assets/_ssl_tls_tabs_breadcrumb.html.tt parent_location_text=locale.maketext('Keys') current_location_text=locale.maketext('Upload Key File') go_back_location='keys.html' go_back_link_text=locale.maketext('Go Back') %] [% END %] [% END %]

[% IF FORM.type == 'paste' %] [% locale.maketext('Upload Key') %] [% ELSIF FORM.type == 'upload' %] [% locale.maketext('Upload Key File') %] [% END %]

[% IF upload_key.status; %]
[% IF FORM.type == 'paste' %] [% locale.maketext('You have successfully uploaded the private key to your account.') %] [% ELSIF FORM.type == 'upload' %] [% locale.maketext('You have successfully uploaded the private key file “[_1]” to your account.', safe_file_name) %] [% END %] [% IF upload_key.messages_as_string; %] [% upload_key.messages_as_string FILTER html %] [% END %]

[% locale.maketext('[output,strong,Name]: [_1]', safe_name) %]

[% locale.maketext('[output,strong,ID]: [_1]', safe_id) %]

[% ELSE %]
[% IF FORM.type == 'paste' %] [% locale.maketext('The system failed to save the private key to your account.') %] [% ELSIF FORM.type == 'upload' %] [% locale.maketext('The system failed to save the private key file “[_1]” to your account.', safe_file_name) %] [% END %] [% IF upload_key.errors_as_string %] [% upload_key.errors_as_string FILTER html %] [% END %]
[% END %]
[% END #wrapper %]