Changes by r.
This commit is contained in:
parent
3960390ec4
commit
5ba239caa8
src/snek/view
@ -31,4 +31,4 @@ class LoginView(BaseFormView):
|
|||||||
"color": user["color"]
|
"color": user["color"]
|
||||||
})
|
})
|
||||||
return {"redirect_url": "/web.html"}
|
return {"redirect_url": "/web.html"}
|
||||||
return {"is_valid": False}
|
return {"is_valid": False}
|
@ -24,8 +24,10 @@ class RegisterView(BaseFormView):
|
|||||||
result = await self.app.services.user.register(
|
result = await self.app.services.user.register(
|
||||||
form.email.value, form.username.value, form.password.value
|
form.email.value, form.username.value, form.password.value
|
||||||
)
|
)
|
||||||
self.request.session["uid"] = result["uid"]
|
self.request.session.update({
|
||||||
self.request.session["username"] = result["username"]
|
"uid": result["uid"],
|
||||||
self.request.session["logged_in"] = True
|
"username": result["username"],
|
||||||
self.request.session["color"] = result["color"]
|
"logged_in": True,
|
||||||
|
"color": result["color"]
|
||||||
|
})
|
||||||
return {"redirect_url": "/web.html"}
|
return {"redirect_url": "/web.html"}
|
@ -14,21 +14,20 @@
|
|||||||
# copies of the Software, and to permit persons to whom the Software is
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
# furnished to do so, subject to the following conditions:
|
# furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
# The above copyright notice and this permission notice shall be included in
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
# all copies or substantial portions of the Software.
|
# copies or substantial portions of the Software.
|
||||||
#
|
#
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
# THE SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
from snek.form.register import RegisterForm
|
from snek.form.register import RegisterForm
|
||||||
from snek.system.view import BaseFormView
|
from snek.system.view import BaseFormView
|
||||||
|
|
||||||
|
|
||||||
class RegisterFormView(BaseFormView):
|
class RegisterFormView(BaseFormView):
|
||||||
form = RegisterForm
|
form = RegisterForm
|
||||||
|
|
||||||
@ -36,8 +35,10 @@ class RegisterFormView(BaseFormView):
|
|||||||
result = await self.app.services.user.register(
|
result = await self.app.services.user.register(
|
||||||
form.email.value, form.username.value, form.password.value
|
form.email.value, form.username.value, form.password.value
|
||||||
)
|
)
|
||||||
self.request.session["uid"] = result["uid"]
|
self.request.session.update({
|
||||||
self.request.session["username"] = result["username"]
|
"uid": result["uid"],
|
||||||
self.request.session["logged_in"] = True
|
"username": result["username"],
|
||||||
|
"logged_in": True,
|
||||||
|
"color": result["color"]
|
||||||
|
})
|
||||||
return {"redirect_url": "/web.html"}
|
return {"redirect_url": "/web.html"}
|
@ -19,11 +19,10 @@
|
|||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||||
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||||
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||||
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
# CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||||
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
from snek.system.view import BaseView
|
from snek.system.view import BaseView
|
||||||
|
|
||||||
class StatusView(BaseView):
|
class StatusView(BaseView):
|
||||||
|
Loading…
Reference in New Issue
Block a user