Make multiuser plugin compatible with wrapper modifications
This commit is contained in:
parent
b57a9f5c58
commit
2f2c49cc47
1 changed files with 11 additions and 23 deletions
|
@ -64,7 +64,7 @@ class UiRequestPlugin(object):
|
|||
<!-- Multiser plugin -->
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
wrapper.notifications.add("login", "done", "{message}<br><small>You have been logged in successfully</small>", 5000)
|
||||
zeroframe.cmd("wrapperNotification", ["done", "{message}<br><small>You have been logged in successfully</small>", 5000])
|
||||
}, 1000)
|
||||
</script>
|
||||
</body>
|
||||
|
@ -127,7 +127,7 @@ class UiWebsocketPlugin(object):
|
|||
def actionUserLogout(self, to):
|
||||
if "ADMIN" not in self.site.settings["permissions"]:
|
||||
return self.response(to, "Logout not allowed")
|
||||
message = "<b>You have been logged out.</b> <a href='#Login' class='button' onclick='wrapper.ws.cmd(\"userLoginForm\", []); return false'>Login to another account</a>"
|
||||
message = "<b>You have been logged out.</b> <a href='#Login' class='button' onclick='zeroframe.cmd(\"userLoginForm\", []); return false'>Login to another account</a>"
|
||||
message += "<script>document.cookie = 'master_address=; expires=Thu, 01 Jan 1970 00:00:00 UTC'</script>"
|
||||
self.cmd("notification", ["done", message, 1000000]) # 1000000 = Show ~forever :)
|
||||
# Delete from user_manager
|
||||
|
@ -152,7 +152,7 @@ class UiWebsocketPlugin(object):
|
|||
if user.master_address:
|
||||
message = "Successfull login, reloading page..."
|
||||
message += "<script>document.cookie = 'master_address=%s;path=/;max-age=2592000;'</script>" % user.master_address
|
||||
message += "<script>wrapper.reload('login=done')</script>"
|
||||
message += "<script>zeroframe.cmd('wrapperReload', ['login=done'])</script>"
|
||||
self.cmd("notification", ["done", message])
|
||||
else:
|
||||
self.cmd("notification", ["error", "Error: Invalid master seed"])
|
||||
|
@ -169,26 +169,14 @@ class UiWebsocketPlugin(object):
|
|||
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)
|
||||
message = "<style>.masterseed { font-size: 95%; background-color: #FFF0AD; padding: 5px 8px; margin: 9px 0px }</style>"
|
||||
message += "<b>Hello, welcome to ZeroProxy!</b><div style='margin-top: 8px'>A new, unique account created for you:</div>"
|
||||
message += "<div class='masterseed'>" + master_seed + "</div>"
|
||||
message += "<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>"
|
||||
message += "<a href='#' class='button' style='margin-left: 0px'>Ok, Saved it!</a><br><br>"
|
||||
message += "<small>This site allows you to browse ZeroNet content, but if you want to secure your account <br>"
|
||||
message += "and help to make a better network, then please run your own <a href='https://zeronet.io' target='_blank'>ZeroNet client</a>.</small>"
|
||||
self.cmd("notification", ["info", message])
|
||||
|
||||
|
||||
@PluginManager.registerTo("ConfigPlugin")
|
||||
|
|
Loading…
Reference in a new issue