Changes by r.

This commit is contained in:
retoor 2025-03-20 02:12:00 +01:00
parent 3960390ec4
commit 5ba239caa8
4 changed files with 21 additions and 19 deletions

View File

@ -31,4 +31,4 @@ class LoginView(BaseFormView):
"color": user["color"]
})
return {"redirect_url": "/web.html"}
return {"is_valid": False}
return {"is_valid": False}

View File

@ -24,8 +24,10 @@ class RegisterView(BaseFormView):
result = await self.app.services.user.register(
form.email.value, form.username.value, form.password.value
)
self.request.session["uid"] = result["uid"]
self.request.session["username"] = result["username"]
self.request.session["logged_in"] = True
self.request.session["color"] = result["color"]
self.request.session.update({
"uid": result["uid"],
"username": result["username"],
"logged_in": True,
"color": result["color"]
})
return {"redirect_url": "/web.html"}

View File

@ -14,21 +14,20 @@
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# 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 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 CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# AUTHORS OR COPYRIGHT 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 OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from snek.form.register import RegisterForm
from snek.system.view import BaseFormView
class RegisterFormView(BaseFormView):
form = RegisterForm
@ -36,8 +35,10 @@ class RegisterFormView(BaseFormView):
result = await self.app.services.user.register(
form.email.value, form.username.value, form.password.value
)
self.request.session["uid"] = result["uid"]
self.request.session["username"] = result["username"]
self.request.session["logged_in"] = True
self.request.session.update({
"uid": result["uid"],
"username": result["username"],
"logged_in": True,
"color": result["color"]
})
return {"redirect_url": "/web.html"}

View File

@ -19,11 +19,10 @@
# 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
# 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
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
# 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
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from snek.system.view import BaseView
class StatusView(BaseView):