server-ux/easy_switch_user/controllers/main.py

15 lines
466 B
Python
Raw Normal View History

2021-03-23 19:38:33 +00:00
# Copyright 2018 Onestein
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from flectra import http
from flectra.http import route
class SwitchController(http.Controller):
@route('/easy_switch_user/switch', type='json', auth="none")
def switch(self, login, password):
request = http.request
uid = request.session.authenticate(request.db, login, password)
if uid is False:
raise Exception('Login Failed')