X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Faccountview.py;h=20c2b05c26e4062df81c34d60482b094e05f8156;hb=3b78ac598a00cdd5c3e079381fa3e1d6466e54e8;hp=8243e392eddf360e2069ba2cf4e51f009bd6c9ca;hpb=be718e3336ee7ad98e90b0b3c97b58b37a467788;p=unfold.git diff --git a/portal/accountview.py b/portal/accountview.py index 8243e392..20c2b05c 100644 --- a/portal/accountview.py +++ b/portal/accountview.py @@ -203,6 +203,7 @@ class AccountView(LoginRequiredAutoLogoutView, ThemeView): # so we can sho who is logged context['username'] = the_user(self.request) context['theme'] = self.theme + context['section'] = "User account" # context ['firstname'] = config['firstname'] prelude_env = page.prelude_env() context.update(prelude_env) @@ -454,6 +455,29 @@ def account_process(request): else: messages.error(request, 'Account error: You need an account in myslice platform to perform this action') return HttpResponseRedirect("/portal/account/") + + # download identity for jfed + elif 'dl_identity' in request.POST: + for account_detail in account_details: + for platform_detail in platform_details: + if platform_detail['platform_id'] == account_detail['platform_id']: + if 'myslice' in platform_detail['platform']: + account_config = json.loads(account_detail['config']) + if 'user_private_key' in account_config: + private_key = account_config['user_private_key'] + user_hrn = account_config.get('user_hrn','N/A') + registry = 'http://sfa-fed4fire.pl.sophia.inria.fr:12345/' + jfed_identity = user_hrn + '\n' + registry + '\n' + private_key + response = HttpResponse(jfed_identity, content_type='text/plain') + response['Content-Disposition'] = 'attachment; filename="jfed_identity.txt"' + return response + else: + messages.error(request, 'Download error: Private key is not stored in the server') + return HttpResponseRedirect("/portal/account/") + + else: + messages.error(request, 'Account error: You need an account in myslice platform to perform this action') + return HttpResponseRedirect("/portal/account/") #clear all creds elif 'clear_cred' in request.POST: