benitlux: percent encode GET args
[nit.git] / contrib / benitlux / src / client / views / user_views.nit
index b69b1db..ff5f31c 100644 (file)
@@ -60,11 +60,7 @@ class UserWindow
                but_logout.enabled = app.user != null
        end
 
-       init
-       do
-               but_logout.observers.add self
-               refresh
-       end
+       init do refresh
 
        redef fun on_event(event)
        do
@@ -128,13 +124,6 @@ class SignupWindow
 
        private var but_signup = new Button(parent=layout_register, text="Signup".t)
 
-       init
-       do
-               for c in [but_login, but_signup] do
-                       c.observers.add self
-               end
-       end
-
        redef fun on_event(event)
        do
                if debug then print "BenitluxWindow::on_event {event}"
@@ -157,7 +146,7 @@ class SignupWindow
 
                                if sender == but_login then
                                        feedback "Logging in...".t
-                                       (new LoginOrSignupAction(self, "rest/login?name={name}&pass={pass.pass_hash}")).start
+                                       (new LoginOrSignupAction(self, "rest/login?name={name.to_percent_encoding}&pass={pass.pass_hash}")).start
                                else if sender == but_signup then
                                        if pass != txt_pass2.text then
                                                feedback "Passwords do not match.".t
@@ -171,7 +160,7 @@ class SignupWindow
                                        end
 
                                        feedback "Signing up...".t
-                                       (new LoginOrSignupAction(self, "rest/signup?name={name}&pass={pass.pass_hash}&email={email}")).start
+                                       (new LoginOrSignupAction(self, "rest/signup?name={name.to_percent_encoding}&pass={pass.pass_hash}&email={email.to_percent_encoding}")).start
                                end
                        end
                end
@@ -194,7 +183,7 @@ class LoginOrSignupAction
 
        init do affected_views.add_all([window.but_login, window.but_signup])
 
-       redef fun on_load(res)
+       redef fun on_load(res, status)
        do
                if intercept_error(res) then return