Coverage for /home/runner/work/viur-core/viur-core/viur/src/viur/core/render/vi/user.py: 0%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.3, created at 2024-10-16 22:16 +0000

1from viur.core import current 

2from viur.core.render.json.user import UserRender as user 

3import string, json 

4 

5 

6class UserRender(user): 

7 kind = "json.vi" 

8 

9 def loginSucceeded(self, **kwargs): 

10 """ 

11 This loginSuccess method generates a HTML site, which redirects by meta-refresh to the Vi, 

12 but can also be easily read by Ajax requests. 

13 """ 

14 if current.request.get().context.get("vi-admin"): 

15 return json.dumps(kwargs.get("msg", "OKAY")) 

16 msg = "".join([x for x in kwargs.get("msg", "OKAY") if x in string.digits + string.ascii_letters + "-"]) 

17 

18 return f""" 

19 <html> 

20 <head> 

21 <meta http-equiv="refresh" content="0; URL=/vi/s/main.html"> 

22 </head> 

23 <body style="text-align: center;"> 

24 You will be redirected to <a href="/vi/s/main.html">/vi/s/main.html</a> in a short moment... 

25 <div style="display: none;" id="msg">JSON(({json.dumps(msg)}))</div> 

26 </body> 

27 </html> 

28 """