server-ux/easy_switch_user/controllers/main.py
2021-03-23 20:38:33 +01:00

15 lines
466 B
Python

# 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')