Show proxy user seed on certficate added instead of first visit
This commit is contained in:
parent
cfeb2797e3
commit
9df86ecaa9
1 changed files with 24 additions and 27 deletions
|
@ -58,33 +58,6 @@ class UiRequestPlugin(object):
|
|||
if not back_generator: # Wrapper error or not string returned, injection not possible
|
||||
return False
|
||||
|
||||
if user_created:
|
||||
back = back_generator.next()
|
||||
master_seed = user.master_seed
|
||||
# Inject the welcome message
|
||||
inject_html = """
|
||||
<!-- Multiser plugin -->
|
||||
<style>
|
||||
.masterseed { font-size: 95%; background-color: #FFF0AD; padding: 5px 8px; margin: 9px 0px }
|
||||
</style>
|
||||
<script>
|
||||
hello_message = "<b>Hello, welcome to ZeroProxy!</b><div style='margin-top: 8px'>A new, unique account created for you:</div>"
|
||||
hello_message+= "<div class='masterseed'>{master_seed}</div> <div>This is your private key, <b>save it</b>, so you can login next time.</div><br>"
|
||||
hello_message+= "<a href='#' class='button' style='margin-left: 0px'>Ok, Saved it!</a> or <a href='#Login' onclick='wrapper.ws.cmd(\\"userLoginForm\\", []); return false'>Login</a><br><br>"
|
||||
hello_message+= "<small>This site allows you to browse ZeroNet content, but if you want to secure your account <br>"
|
||||
hello_message+= "and help to make a better network, then please run your own <a href='https://github.com/HelloZeroNet/ZeroNet' target='_blank'>ZeroNet client</a>.</small>"
|
||||
setTimeout(function() {
|
||||
wrapper.notifications.add("hello", "info", hello_message)
|
||||
delete(hello_message)
|
||||
}, 1000)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
""".replace("\t", "")
|
||||
inject_html = inject_html.replace("{master_seed}", master_seed) # Set the master seed in the message
|
||||
|
||||
return iter([re.sub("</body>\s*</html>\s*$", inject_html, back)]) # Replace the </body></html> tags with the injection
|
||||
|
||||
elif loggedin:
|
||||
back = back_generator.next()
|
||||
inject_html = """
|
||||
|
@ -193,6 +166,30 @@ class UiWebsocketPlugin(object):
|
|||
else:
|
||||
return super(UiWebsocketPlugin, self).hasCmdPermission(cmd)
|
||||
|
||||
def actionCertAdd(self, *args, **kwargs):
|
||||
super(UiWebsocketPlugin, self).actionCertAdd(*args, **kwargs)
|
||||
master_seed = self.user.master_seed
|
||||
# Inject the welcome message
|
||||
inject_html = """
|
||||
<!-- Multiser plugin -->
|
||||
<style>
|
||||
.masterseed { font-size: 95%; background-color: #FFF0AD; padding: 5px 8px; margin: 9px 0px }
|
||||
</style>
|
||||
<script>
|
||||
hello_message = "<b>Hello, welcome to ZeroProxy!</b><div style='margin-top: 8px'>A new, unique account created for you:</div>"
|
||||
hello_message+= "<div class='masterseed'>{master_seed}</div> <div>This is your private key, <b>save it</b>, so you can login next time.<br>Without this key, your registered account will be lost forever!</div><br>"
|
||||
hello_message+= "<a href='#' class='button' style='margin-left: 0px'>Ok, Saved it!</a><br><br>"
|
||||
hello_message+= "<small>This site allows you to browse ZeroNet content, but if you want to secure your account <br>"
|
||||
hello_message+= "and help to make a better network, then please run your own <a href='https://zeronet.io' target='_blank'>ZeroNet client</a>.</small>"
|
||||
setTimeout(function() {
|
||||
wrapper.notifications.add("hello", "info", hello_message)
|
||||
delete(hello_message)
|
||||
}, 1000)
|
||||
</script>
|
||||
""".replace("\t", "")
|
||||
inject_html = inject_html.replace("{master_seed}", master_seed) # Set the master seed in the message
|
||||
self.cmd("injectHtml", inject_html)
|
||||
|
||||
|
||||
@PluginManager.registerTo("ConfigPlugin")
|
||||
class ConfigPlugin(object):
|
||||
|
|
Loading…
Reference in a new issue