mirror of
https://github.com/bringout/oca-server-auth.git
synced 2026-04-18 23:32:03 +02:00
Initial commit: OCA Server Auth packages (29 packages)
This commit is contained in:
commit
3ed80311c4
1325 changed files with 127292 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
# © 2021 Florian Kantelberg - initOS GmbH
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import main
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
# © 2021 Florian Kantelberg - initOS GmbH
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import _, http
|
||||
from odoo.http import request
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Controller(http.Controller):
|
||||
@http.route("/vault/share/<string:token>", type="http", auth="public")
|
||||
def vault_share(self, token):
|
||||
ctx = {"disable_footer": True, "token": token}
|
||||
share = request.env["vault.share"].sudo()
|
||||
secret = share.get(token, ip=request.httprequest.remote_addr)
|
||||
if secret is None:
|
||||
ctx["error"] = _("The secret expired")
|
||||
return request.render("vault_share.share", ctx)
|
||||
|
||||
if len(secret) != 1:
|
||||
ctx["error"] = _("Invalid token")
|
||||
return request.render("vault_share.share", ctx)
|
||||
|
||||
ctx.update(
|
||||
{
|
||||
"encrypted": secret.secret,
|
||||
"salt": secret.salt,
|
||||
"iv": secret.iv,
|
||||
"encrypted_file": secret.secret_file,
|
||||
"filename": secret.filename,
|
||||
"iterations": secret.iterations,
|
||||
}
|
||||
)
|
||||
return request.render("vault_share.share", ctx)
|
||||
Loading…
Add table
Add a link
Reference in a new issue