Integra la pantalla de inicio de sesión v1 y cierra el alta pública
Trae a main el trabajo de la rama login-v1: - La pantalla de inicio de sesión, por herencia de web.login y web.login_layout, sin tocar el core ni el formulario que autentica. - Manrope y el color de línea sacados a piezas compartidas, para que el paquete frontend pueda resolver la tipografía antes de la sesión. - El logo del login de 1.19 MB a 20.2 KB. - El alta pública cerrada por datos del módulo (invitation_scope en b2b): /web/signup deja de responder a quien no traiga invitación. OJO, esto cambia el comportamiento en producción. - La regla 7 de CLAUDE.md: el entorno del desarrollador no se toca sin autorización explícita. Suite de beyond_base en verde (40 pruebas). Los 5 fallos + 1 error que siguen en beyond_branch son anteriores a esta rama y no los toca: uno es podredumbre de la base de desarrollo (compañías demo) y cinco son un hueco real del código — nada crea el IVA 16%, y se reproducen igual en una base recién instalada. Pendiente de decisión. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
8561398744
15 files changed
+1135
-69
No files matched your search
@@ -24,6 +24,7 @@ Sistema de gestión multisucursal para Beyond (red de sucursales en Puebla, Méx
|
||||
4. **Español** en toda cadena visible al usuario. Código, nombres de campos, modelos y comentarios técnicos en inglés.
|
||||
5. **Nada que corra en la carga de módulos puede impedir el arranque** (ADR-011). Toda tarea de `<function>`, `init()` o hook va envuelta en `ejecutar_en_arranque` (`beyond_base/tools/arranque.py`): si falla, se registra y el sistema levanta. Los datos de módulo **no** escriben sobre modelos con guardias de estado (`pos.config`, `account.tax`, `pos.payment.method`): eso va en una función que detecta la condición y difiere. Una caja de POS abierta ya tumbó producción una vez.
|
||||
6. **Aislamiento por sucursal es sagrado:** cualquier modelo operativo nuevo lleva `branch_id` y su `ir.rule`. Todo cambio de permisos lleva test automatizado (brief, sección 4).
|
||||
7. **No modificar el entorno del desarrollador** (credenciales, bases, configuración, servicios) **sin autorización explícita en el encargo** (23-ago-2026). Si falta acceso, preguntar u operar en stack desechable. Todo cambio de entorno autorizado se reporta con su reversa.
|
||||
|
||||
## Convenciones
|
||||
|
||||
|
||||
@@ -9,24 +9,29 @@ Cimientos del sistema Beyond (BRIEF §4 y §6):
|
||||
administrador de sucursal y empleado. Las reglas de registro (ir.rule)
|
||||
que aíslan datos por sucursal llegan en Fase 1 junto con beyond_branch.
|
||||
- Branding: nombre "Beyond" de la instancia, identidad visual v1 definida
|
||||
por Collina (paleta y tipografía Manrope autoalojada) y el lanzador de
|
||||
aplicaciones a pantalla completa (ADR-005).
|
||||
por Collina (paleta y tipografía Manrope autoalojada), el lanzador de
|
||||
aplicaciones a pantalla completa (ADR-005) y la pantalla de inicio de
|
||||
sesión, que hereda web.login sin tocar ni el formulario ni la ruta.
|
||||
|
||||
Depende de hr/hr_attendance porque el rol "empleado" se define sobre
|
||||
empleados y asistencias, y las ir.rule de Fase 1 para esos modelos
|
||||
vivirán en este módulo.
|
||||
vivirán en este módulo. Depende de auth_signup (LGPL, el core lo
|
||||
auto-instala igual) para fijar el orden de herencia sobre web.login: el
|
||||
enlace de "¿Olvidaste tu contraseña?" es el suyo, con su condición real.
|
||||
""",
|
||||
'version': '19.0.0.1.0',
|
||||
'category': 'Beyond',
|
||||
'author': 'Collina Systems',
|
||||
'license': 'Other proprietary',
|
||||
'depends': ['base', 'web', 'hr', 'hr_attendance'],
|
||||
'depends': ['base', 'web', 'auth_signup', 'hr', 'hr_attendance'],
|
||||
'data': [
|
||||
'security/beyond_security.xml',
|
||||
'data/branding.xml',
|
||||
'data/bootstrap_admin.xml',
|
||||
'data/menu_cleanup.xml',
|
||||
'data/idioma.xml',
|
||||
'data/signup.xml',
|
||||
'views/login_templates.xml',
|
||||
],
|
||||
'demo': [
|
||||
'demo/demo_empleados.xml',
|
||||
@@ -36,10 +41,18 @@ vivirán en este módulo.
|
||||
('prepend', 'beyond_base/static/src/scss/beyond_variables.scss'),
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'beyond_base/static/src/scss/beyond_fonts.scss',
|
||||
'beyond_base/static/src/webclient/beyond_launcher.scss',
|
||||
'beyond_base/static/src/webclient/beyond_launcher.js',
|
||||
'beyond_base/static/src/webclient/beyond_launcher.xml',
|
||||
],
|
||||
# The login screen renders before there is a session: it gets the
|
||||
# frontend bundle and nothing else, so the face travels with it.
|
||||
'web.assets_frontend': [
|
||||
'beyond_base/static/src/scss/beyond_fonts.scss',
|
||||
'beyond_base/static/src/login/beyond_login.scss',
|
||||
'beyond_base/static/src/login/beyond_login.js',
|
||||
],
|
||||
},
|
||||
'installable': True,
|
||||
'application': False,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<!-- Alta pública cerrada en cada actualización (que en producción corre en
|
||||
cada arranque): /web/signup sin invitación devuelve 404 y un POST sin
|
||||
token no crea usuario. El alta CON invitación no se toca — es la vía
|
||||
del aprovisionador (ADR-008). Ver models/res_users.py. -->
|
||||
<function model="res.users" name="_beyond_arranque_alta_publica"/>
|
||||
</odoo>
|
||||
@@ -1,2 +1,3 @@
|
||||
# Part of Beyond. Collina Systems proprietary module.
|
||||
from . import res_lang
|
||||
from . import res_users
|
||||
@@ -0,0 +1,51 @@
|
||||
# Part of Beyond. Collina Systems proprietary module.
|
||||
from odoo import api, models
|
||||
|
||||
from odoo.addons.beyond_base.tools.arranque import ejecutar_en_arranque
|
||||
|
||||
# auth_signup se instala solo (auto_install) y llega con la puerta abierta: sus
|
||||
# datos ponen auth_signup.invitation_scope en 'b2c' — "Free sign up" —, que deja
|
||||
# /web/signup accesible a cualquiera que teclee la URL. En un ERP de personal de
|
||||
# sucursal eso es un alta de cuenta sin invitación contra el sistema que lleva
|
||||
# la caja. A Beyond se entra dado de alta por la administración (ADR-008).
|
||||
#
|
||||
# Con 'b2b' Odoo cierra las dos puertas por su cuenta: la ruta /web/signup sin
|
||||
# token devuelve 404, y _signup_create_user levanta SignupError si alguien
|
||||
# postea sin invitación. No se toca ni la ruta ni el controlador; se le da al
|
||||
# core el valor con el que ya sabe defenderse.
|
||||
#
|
||||
# El alta CON invitación sigue funcionando, y tiene que seguir: es la vía por la
|
||||
# que el aprovisionador manda el correo de bienvenida al dar de alta a alguien.
|
||||
ALTA_SOLO_POR_INVITACION = 'b2b'
|
||||
|
||||
PARAMETRO_ALTA = 'auth_signup.invitation_scope'
|
||||
|
||||
|
||||
class ResUsers(models.Model):
|
||||
_inherit = 'res.users'
|
||||
|
||||
@api.model
|
||||
def _beyond_arranque_alta_publica(self):
|
||||
"""Entrada desde la carga de módulos (data/signup.xml). Va envuelta: una
|
||||
tarea de arranque degrada, nunca tumba el servidor (ADR-011)."""
|
||||
return ejecutar_en_arranque(
|
||||
self.env, 'Alta pública cerrada', self._beyond_cerrar_alta_publica)
|
||||
|
||||
@api.model
|
||||
def _beyond_cerrar_alta_publica(self):
|
||||
"""Deja el alta pública cerrada en cualquier despliegue.
|
||||
|
||||
Corre en cada actualización del módulo, que en producción corre en cada
|
||||
arranque: el candado no depende de que alguien se acuerde de tocar el
|
||||
interruptor en Ajustes, y una base restaurada o clonada llega cerrada
|
||||
sola. Idempotente: si ya está cerrada no escribe nada.
|
||||
|
||||
Que se reafirme en cada actualización es lo que se quiere. Si el día de
|
||||
mañana Beyond decide abrir el alta pública, la decisión se toma aquí y
|
||||
queda en el repositorio, no en un clic que la siguiente actualización
|
||||
deshace sin que nadie se entere.
|
||||
"""
|
||||
parametros = self.env['ir.config_parameter'].sudo()
|
||||
if parametros.get_param(PARAMETRO_ALTA) != ALTA_SOLO_POR_INVITACION:
|
||||
parametros.set_param(PARAMETRO_ALTA, ALTA_SOLO_POR_INVITACION)
|
||||
return True
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Beyond — login v1: the eye that shows the password.
|
||||
*
|
||||
* Core ships this behaviour (web/static/src/public/show_password.js) but it is
|
||||
* bound to a Bootstrap `.input-group` wrapping a `.o_show_password` button with
|
||||
* a Font Awesome icon, and it says nothing to a screen reader. The login screen
|
||||
* uses the design's own pill and its own SVG, so the toggle is rewritten here —
|
||||
* eight lines and the ARIA that core leaves out.
|
||||
*
|
||||
* Deliberately a plain script and not an Interaction: this runs on the page
|
||||
* that precedes the session, where the less machinery involved in reaching the
|
||||
* password field, the better. It touches nothing but the input's `type`.
|
||||
*
|
||||
* Not touched: the form, its action, its method or the csrf_token.
|
||||
*/
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
// Spanish, like every string a user reads (CLAUDE.md).
|
||||
const LABEL_SHOW = "Mostrar contraseña";
|
||||
const LABEL_HIDE = "Ocultar contraseña";
|
||||
|
||||
function setUpPasswordToggle() {
|
||||
const eye = document.querySelector(".beyond_login .beyond_login_eye");
|
||||
const password = document.querySelector(".beyond_login #password");
|
||||
if (!eye || !password) {
|
||||
return;
|
||||
}
|
||||
eye.addEventListener("click", function () {
|
||||
const wasVisible = password.type === "text";
|
||||
password.type = wasVisible ? "password" : "text";
|
||||
eye.setAttribute("aria-pressed", String(!wasVisible));
|
||||
eye.setAttribute("aria-label", wasVisible ? LABEL_SHOW : LABEL_HIDE);
|
||||
// Back to typing where the user left off, not on the button.
|
||||
password.focus();
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", setUpPasswordToggle);
|
||||
} else {
|
||||
setUpPasswordToggle();
|
||||
}
|
||||
})();
|
||||
@@ -0,0 +1,500 @@
|
||||
// =============================================================================
|
||||
// Beyond — login v1
|
||||
//
|
||||
// Faithful translation of the signed-off "Iniciar sesión" (login_v1.html).
|
||||
// Every colour, radius, size, gap, duration and font weight below is copied
|
||||
// from that file, unrounded; the rules that have no counterpart there are
|
||||
// marked ENGINEERING and say what they protect against — the design only
|
||||
// covers the nominal case, and this one sits on top of Odoo's real login form.
|
||||
//
|
||||
// SCOPE — everything is nested under .beyond_login / .beyond_login_body. This
|
||||
// file rides web.assets_frontend, which every public page loads (the employee
|
||||
// portal of beyond_attendance_qr among them), so not one rule may escape the
|
||||
// login screen. The QR kiosk is a standalone <html> template that calls no
|
||||
// bundle at all and is out of reach by construction.
|
||||
//
|
||||
// PALETTE — the surfaces and the ink are the identity's own tokens; the design
|
||||
// reuses them exactly. The black is NOT: the design paints the controls
|
||||
// #191613 instead of the brand green, deliberately, so the pre-session screen
|
||||
// reads as the product's cover rather than as another green ERP form. Per the
|
||||
// rule written in scss/beyond_variables.scss ("a colour graduates to a token
|
||||
// when a SECOND screen needs it") that black, the field white, the placeholder
|
||||
// grey and the eye's hover stay local variables here. So does the error
|
||||
// orange, even though it is byte-for-byte the launcher's "Panel General":
|
||||
// same hex, unrelated meaning.
|
||||
// =============================================================================
|
||||
|
||||
// The control black of the login and its hover/pressed states.
|
||||
$beyond-login-ink: #191613;
|
||||
$beyond-login-ink-hover: #33302B;
|
||||
$beyond-login-ink-active: #000000;
|
||||
|
||||
// The brand panel behind the logo — flat black, not the ink above.
|
||||
$beyond-login-brand-bg: #000000;
|
||||
|
||||
// Fields
|
||||
$beyond-login-field-bg: #FFFFFF;
|
||||
$beyond-login-placeholder: #B3ADA3;
|
||||
$beyond-login-eye-hover: #F0EEE8;
|
||||
|
||||
// The focus ring the design draws around a field in focus.
|
||||
$beyond-login-ring: rgba(25, 22, 19, 0.10);
|
||||
|
||||
// Error text. Same hex as $beyond-launcher-panel and unrelated to it.
|
||||
$beyond-login-error: #C55A22;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Page
|
||||
//
|
||||
// ENGINEERING — the class replaces Odoo's `bg-100` on <body> rather than
|
||||
// joining it (see views/login_templates.xml): the utility paints the body with
|
||||
// !important and there is no point in an override war on a page we own whole.
|
||||
// -----------------------------------------------------------------------------
|
||||
.beyond_login_body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: $beyond-surface;
|
||||
color: $beyond-ink;
|
||||
font-family: $beyond-font-family;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
overflow: hidden; // the design is 100vh with no scroll
|
||||
}
|
||||
|
||||
.beyond_login {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
background: $beyond-surface;
|
||||
color: $beyond-ink;
|
||||
overflow: hidden;
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Left: the brand panel
|
||||
// ---------------------------------------------------------------------
|
||||
.beyond_login_brand {
|
||||
flex: 1 1 46%;
|
||||
min-width: 0;
|
||||
background: $beyond-login-brand-bg;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 56px;
|
||||
}
|
||||
|
||||
.beyond_login_logo {
|
||||
display: block;
|
||||
// The design says `width: min(360px, 72%)`. Written as a pair because
|
||||
// Sass evaluates a bare min() itself and refuses to compare px with %;
|
||||
// the used width is identical.
|
||||
width: 72%;
|
||||
max-width: 360px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Right: the form
|
||||
// ---------------------------------------------------------------------
|
||||
.beyond_login_panel {
|
||||
flex: 1 1 54%;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 40px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.beyond_login_stack {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
max-width: 440px;
|
||||
margin: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 26px;
|
||||
}
|
||||
|
||||
// ENGINEERING — web.login ships two empty `oe_structure` drop zones around
|
||||
// the form. Empty flex children still eat a 26px gap each, so they are
|
||||
// hidden while empty and left alone the moment anything is dropped in.
|
||||
.oe_structure:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.beyond_login_title {
|
||||
font-size: 34px;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.03em;
|
||||
color: $beyond-ink;
|
||||
}
|
||||
|
||||
// The form is a column on the same 26px rhythm as the stack around it, so
|
||||
// title / user / password / CTA / error / signature read as one list.
|
||||
.beyond_login_form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 26px;
|
||||
}
|
||||
|
||||
// ENGINEERING — the database picker is core's, shown only when the server
|
||||
// serves more than one database. It keeps its Bootstrap look (a developer
|
||||
// sees it, an employee never does); all it needs is to stop fighting the
|
||||
// column's own rhythm with a utility margin.
|
||||
.beyond_login_form > .mb-3 {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Fields
|
||||
// ---------------------------------------------------------------------
|
||||
.beyond_login_field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.beyond_login_field_head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.beyond_login_label {
|
||||
margin: 0; // ENGINEERING — Bootstrap's reboot puts a margin on <label>
|
||||
font-size: 13px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.02em;
|
||||
color: $beyond-ink-soft;
|
||||
}
|
||||
|
||||
.beyond_login_forgot {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: $beyond-ink-softer;
|
||||
text-decoration: none;
|
||||
|
||||
// ENGINEERING — the design's global rule is `a { #191613 }` with
|
||||
// `a:hover { #7A736A }`, and this link is already painted the hover
|
||||
// colour, which would leave it with no feedback at all. It uses the
|
||||
// same two colours, the other way round.
|
||||
&:hover {
|
||||
color: $beyond-login-ink;
|
||||
}
|
||||
}
|
||||
|
||||
.beyond_login_input {
|
||||
all: unset;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 16px 18px;
|
||||
border-radius: 16px;
|
||||
background: $beyond-login-field-bg;
|
||||
border: 1.5px solid $beyond-line;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: $beyond-ink;
|
||||
transition: border-color 140ms ease, box-shadow 140ms ease;
|
||||
|
||||
// Keyboard only, per the project rule — but a text field in focus
|
||||
// always matches :focus-visible, click or Tab, because it is about to
|
||||
// take keystrokes. The design's focus state survives intact.
|
||||
&:focus-visible {
|
||||
border-color: $beyond-login-ink;
|
||||
box-shadow: 0 0 0 4px $beyond-login-ring;
|
||||
}
|
||||
}
|
||||
|
||||
// The password field is a bare input inside a pill that carries the frame,
|
||||
// so that the eye button can live on the same border.
|
||||
.beyond_login_pw {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 4px 6px 4px 18px;
|
||||
border-radius: 16px;
|
||||
background: $beyond-login-field-bg;
|
||||
border: 1.5px solid $beyond-line;
|
||||
transition: border-color 140ms ease, box-shadow 140ms ease;
|
||||
|
||||
// The design's rule is :focus-within; :has(:focus-visible) is the same
|
||||
// thing restricted to keyboard focus, so the eye button being clicked
|
||||
// does not light the whole pill.
|
||||
&:has(:focus-visible) {
|
||||
border-color: $beyond-login-ink;
|
||||
box-shadow: 0 0 0 4px $beyond-login-ring;
|
||||
}
|
||||
}
|
||||
|
||||
.beyond_login_input_pw {
|
||||
all: unset;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 12px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: $beyond-ink;
|
||||
}
|
||||
|
||||
.beyond_login_input,
|
||||
.beyond_login_input_pw {
|
||||
&::placeholder {
|
||||
color: $beyond-login-placeholder;
|
||||
}
|
||||
}
|
||||
|
||||
.beyond_login_eye {
|
||||
all: unset;
|
||||
position: relative; // ENGINEERING — anchors the touch target below
|
||||
flex: none; // ENGINEERING — the pill must not squeeze it
|
||||
cursor: pointer;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: $beyond-ink-softer; // the icon strokes currentColor
|
||||
transition: background 140ms ease, color 140ms ease;
|
||||
|
||||
&:hover {
|
||||
background: $beyond-login-eye-hover;
|
||||
}
|
||||
|
||||
// ENGINEERING — the design paints a 44x44 box; the project floor for a
|
||||
// touch target is 48 (CLAUDE.md, "Norte de diseño"). The painted box
|
||||
// stays 44 and an invisible 48x48 sits centred on it, inside the room
|
||||
// the pill's own padding leaves. Nothing moves, the finger gets 48.
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
}
|
||||
|
||||
// ENGINEERING — the password is on screen; say so with more than the
|
||||
// characters themselves. Pairs with aria-pressed on the button.
|
||||
&[aria-pressed="true"] {
|
||||
color: $beyond-ink;
|
||||
}
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Call to action
|
||||
// ---------------------------------------------------------------------
|
||||
// ENGINEERING — core wraps the CTA and everything auth_signup/auth_passkey
|
||||
// bolt onto it in one `oe_login_buttons` div. That div has to survive (it
|
||||
// is their xpath anchor) but it must not be a box, or its contents cannot
|
||||
// be interleaved with the server's messages. `display: contents` dissolves
|
||||
// it: the CTA and the passkey block become items of the form's own column,
|
||||
// on its 26px rhythm, and `order` below can place the message between them
|
||||
// — under the CTA, where the design puts it.
|
||||
.beyond_login_actions {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.beyond_login_submit {
|
||||
all: unset;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 18px;
|
||||
border-radius: 16px;
|
||||
background: $beyond-login-ink;
|
||||
color: #FFFFFF;
|
||||
text-align: center;
|
||||
font-size: 17px;
|
||||
font-weight: 800;
|
||||
letter-spacing: 0.01em;
|
||||
transition: background 140ms ease, transform 120ms ease;
|
||||
|
||||
&:hover {
|
||||
background: $beyond-login-ink-hover;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: $beyond-login-ink-active;
|
||||
transform: translateY(1px);
|
||||
}
|
||||
}
|
||||
|
||||
// ENGINEERING — `all: unset` strips the browser's own focus ring off every
|
||||
// control on this screen, so the keyboard ring has to be put back by hand.
|
||||
// :focus-visible only, so a click leaves no outline. The text fields are
|
||||
// excluded: they light up through the design's own focus state above.
|
||||
.beyond_login_submit,
|
||||
.beyond_login_eye,
|
||||
.beyond_login_forgot,
|
||||
.o_login_auth .list-group-item {
|
||||
&:focus-visible {
|
||||
outline: 3px solid $beyond-login-ink;
|
||||
outline-offset: 3px;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Server messages
|
||||
//
|
||||
// Odoo writes these after the POST — "Wrong login/password", the reset
|
||||
// mail confirmation, an access notice. There is no client-side validation
|
||||
// on this screen and no invented copy: whatever the server says, in the
|
||||
// design's voice.
|
||||
//
|
||||
// ENGINEERING — `order` because the design puts the message under the CTA
|
||||
// while web.login emits it above. Visual order follows the design, source
|
||||
// order stays the accessible one (a screen reader meets the error before
|
||||
// the button that produced it).
|
||||
// ---------------------------------------------------------------------
|
||||
.beyond_login_error,
|
||||
.beyond_login_message,
|
||||
.o_caps_lock_warning_text {
|
||||
order: 1;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
// ...and the passkey block after it, so the message stays glued to the CTA
|
||||
// that produced it instead of being pushed below an alternative way in.
|
||||
.o_login_auth {
|
||||
order: 2;
|
||||
}
|
||||
|
||||
.beyond_login_error,
|
||||
.o_caps_lock_warning_text {
|
||||
color: $beyond-login-error;
|
||||
}
|
||||
|
||||
// Success is the brand green — the only place on this screen it appears.
|
||||
.beyond_login_message {
|
||||
color: $beyond-primary;
|
||||
}
|
||||
|
||||
.o_caps_lock_warning_text {
|
||||
display: block;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Passkeys
|
||||
//
|
||||
// Not in the design, and kept anyway: auth_passkey is installed and this
|
||||
// block is a real way into the system. Dropping it would lock out anyone
|
||||
// who registered a key. Dressed in the field's own clothes instead.
|
||||
// ---------------------------------------------------------------------
|
||||
.o_login_auth {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
|
||||
> em {
|
||||
margin: 0;
|
||||
font-style: normal;
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
color: $beyond-ink-muted;
|
||||
}
|
||||
|
||||
.list-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
all: unset;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
// ENGINEERING — core builds this link from a dict and hangs
|
||||
// Bootstrap utilities on it (`py-2`, `d-flex`, `gap-2`), which are
|
||||
// !important. min-height carries the 48px touch floor without
|
||||
// joining an !important war; the horizontal padding is ours
|
||||
// because no utility sets it.
|
||||
min-height: 56px;
|
||||
padding-left: 18px;
|
||||
padding-right: 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
border-radius: 16px;
|
||||
background: $beyond-login-field-bg;
|
||||
border: 1.5px solid $beyond-line;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
color: $beyond-ink;
|
||||
text-align: center;
|
||||
transition: background 140ms ease, border-color 140ms ease;
|
||||
|
||||
&:hover {
|
||||
background: $beyond-surface-hover;
|
||||
border-color: $beyond-ink-softer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// The signature, at the foot
|
||||
// ---------------------------------------------------------------------
|
||||
.beyond_login_sign {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
color: $beyond-ink-muted;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Narrow
|
||||
//
|
||||
// ENGINEERING — the design is one desktop artboard. Below the tablet
|
||||
// breakpoint the 46% black column would leave the form a strip too thin to
|
||||
// fill, so the panel collapses into a short band above the form and the form
|
||||
// takes the whole width. Checked at 768px and at 390px.
|
||||
// -----------------------------------------------------------------------------
|
||||
@media (max-width: 991.98px) {
|
||||
.beyond_login_body {
|
||||
overflow: auto; // stacked, the page is allowed to be taller than the viewport
|
||||
}
|
||||
|
||||
.beyond_login {
|
||||
height: auto;
|
||||
min-height: 100vh;
|
||||
flex-direction: column;
|
||||
overflow: visible;
|
||||
|
||||
.beyond_login_brand {
|
||||
flex: 0 0 auto;
|
||||
padding: 28px 24px;
|
||||
}
|
||||
|
||||
.beyond_login_logo {
|
||||
width: 60%;
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.beyond_login_panel {
|
||||
flex: 1 1 auto;
|
||||
padding: 32px 24px 40px;
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A phone on its side, or a short window: the band would take the screen the
|
||||
// form needs, so the logo goes and the form gets everything.
|
||||
@media (max-width: 991.98px) and (max-height: 520px) {
|
||||
.beyond_login .beyond_login_brand {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// =============================================================================
|
||||
// Manrope, self-hosted — the face of the Beyond identity (ADR-005).
|
||||
//
|
||||
// This block used to live in webclient/beyond_launcher.scss, where it was
|
||||
// reachable only from web.assets_backend. The login screen (C-0xx) is a
|
||||
// PRE-SESSION page: it renders through web.assets_frontend and never receives
|
||||
// a single backend asset, so it could not resolve the family. Rather than
|
||||
// copy six @font-face rules into a second file, they moved here and the file
|
||||
// is listed in both bundles.
|
||||
//
|
||||
// NOT loaded from Google Fonts on purpose: the branch terminals have to keep
|
||||
// working with no internet. These are the same variable woff2 subsets the
|
||||
// design shipped (one file per unicode range, weight axis 500-800), so every
|
||||
// weight the designs use resolves from one file per range.
|
||||
//
|
||||
// The kiosk page (beyond_attendance_qr/views/kiosco_templates.xml) still
|
||||
// restates the two latin ranges inline: it is a standalone <html> template
|
||||
// that calls no bundle at all, so it cannot include this file.
|
||||
// =============================================================================
|
||||
|
||||
// The family token lives with the @font-face rules that make it resolvable —
|
||||
// never on its own in beyond_variables.scss, which is prepended to bundles
|
||||
// (POS) where these files are not served and the promise would be empty.
|
||||
$beyond-font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
|
||||
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-cyrillic-ext.woff2') format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-cyrillic.woff2') format('woff2');
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-greek.woff2') format('woff2');
|
||||
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-vietnamese.woff2') format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-latin-ext.woff2') format('woff2');
|
||||
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-latin.woff2') format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
@@ -21,12 +21,22 @@
|
||||
// of one block on one screen and means nothing outside it. It stays a
|
||||
// local variable in webclient/beyond_launcher.scss. Publishing it in this
|
||||
// bundle would push it into the backend and POS and invite its use as a
|
||||
// semantic colour.
|
||||
// semantic colour. The login v1 error text is that same #C55A22 and it
|
||||
// STILL did not graduate: one hex, two unrelated meanings ("Panel General"
|
||||
// and "something went wrong") is not one token. If a second screen ever
|
||||
// needs an ERROR colour, that is what graduates, under its own name.
|
||||
// · The rule colour graduated (login v1): #DCD8CE was the launcher's
|
||||
// decorative rule under the title and is now also the login's field
|
||||
// borders, so it left beyond_launcher.scss as $beyond-line.
|
||||
//
|
||||
// TYPOGRAPHY — the design uses Manrope. The @font-face rules are declared in
|
||||
// webclient/beyond_launcher.scss because the woff2 files are only wired into
|
||||
// web.assets_backend so far; there is no font-family token here yet on purpose,
|
||||
// a token would promise a face that other bundles (POS) cannot resolve.
|
||||
// TYPOGRAPHY — the designs use Manrope. The @font-face rules and the
|
||||
// $beyond-font-family token live in scss/beyond_fonts.scss, which is listed in
|
||||
// web.assets_backend AND web.assets_frontend (the login screen renders before
|
||||
// the session, from the frontend bundle only). They are deliberately NOT here:
|
||||
// this file is prepended to web._assets_primary_variables, which also feeds
|
||||
// bundles that do not serve the woff2 — the POS — and a family token there
|
||||
// would promise a face that cannot resolve. Ask beyond_fonts.scss for the
|
||||
// family; it ships the face that backs it.
|
||||
// =============================================================================
|
||||
|
||||
// Brand green. The launcher's "Venta" block and its hover/pressed states.
|
||||
@@ -40,6 +50,9 @@ $beyond-kiosco: #8C4A72;
|
||||
$beyond-kiosco-dark: #7C3E64;
|
||||
$beyond-kiosco-darker: #6B3556;
|
||||
|
||||
// Lines. The launcher's rule under the title and the login's field borders.
|
||||
$beyond-line: #DCD8CE;
|
||||
|
||||
// Surfaces
|
||||
$beyond-surface: #F6F5F1; // warm page background
|
||||
$beyond-surface-hover: #ECEAE3; // hover on a surface-coloured control
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
// token when a SECOND screen needs it — which is how the purple became
|
||||
// $beyond-kiosco once the kiosk page and the QR dialog started using it. The
|
||||
// blue, gold and grey are new in v3 and no second screen uses them yet.
|
||||
//
|
||||
// One colour left this file the other way (login v1): the #DCD8CE of the rule
|
||||
// under the title is now also the login field borders, so it graduated to
|
||||
// $beyond-line. The orange above stayed put even though the login's error text
|
||||
// is the same hex — same value, unrelated meaning, and a shared token would
|
||||
// fuse "Panel General" with "something went wrong".
|
||||
// =============================================================================
|
||||
|
||||
// "Panel General"
|
||||
@@ -39,65 +45,10 @@ $beyond-launcher-tableros: #55606E;
|
||||
$beyond-launcher-tableros-hover: #4A545F;
|
||||
$beyond-launcher-tableros-active: #3F4750;
|
||||
|
||||
// Decorative rule under the title
|
||||
$beyond-launcher-rule: #DCD8CE;
|
||||
|
||||
$beyond-font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Manrope, self-hosted. NOT loaded from Google Fonts on purpose: the branch
|
||||
// terminals have to keep working with no internet. These are the same variable
|
||||
// woff2 subsets the design shipped (one file per unicode range, weight axis
|
||||
// 500–800), so the four weights the design uses all resolve from one file.
|
||||
// -----------------------------------------------------------------------------
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-cyrillic-ext.woff2') format('woff2');
|
||||
unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-cyrillic.woff2') format('woff2');
|
||||
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-greek.woff2') format('woff2');
|
||||
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-vietnamese.woff2') format('woff2');
|
||||
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-latin-ext.woff2') format('woff2');
|
||||
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Manrope';
|
||||
font-style: normal;
|
||||
font-weight: 500 800;
|
||||
font-display: swap;
|
||||
src: url('/beyond_base/static/fonts/manrope-latin.woff2') format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
// Manrope and $beyond-font-family now live in scss/beyond_fonts.scss: the login
|
||||
// screen needs the same face from web.assets_frontend, and one copy of six
|
||||
// @font-face rules is enough. That file is listed before this one in
|
||||
// web.assets_backend, so the variable below is already defined here.
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Full-screen shell
|
||||
@@ -147,7 +98,7 @@ $beyond-font-family: Manrope, ui-sans-serif, system-ui, sans-serif;
|
||||
width: 64px;
|
||||
height: 4px;
|
||||
border-radius: 2px;
|
||||
background: $beyond-launcher-rule;
|
||||
background: $beyond-line;
|
||||
}
|
||||
|
||||
// The signature, at the foot
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from . import test_idioma
|
||||
from . import test_login
|
||||
from . import test_menu_cleanup
|
||||
from . import test_security_groups
|
||||
from . import test_signup
|
||||
@@ -0,0 +1,147 @@
|
||||
# Part of Beyond. Collina Systems proprietary module.
|
||||
import os
|
||||
import re
|
||||
|
||||
from odoo.tests import HttpCase, tagged
|
||||
|
||||
MODULE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
LOGO_PATH = os.path.join(MODULE_PATH, 'static', 'img', 'logo_login.png')
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestBeyondLogin(HttpCase):
|
||||
"""Pantalla de inicio de sesión (login v1).
|
||||
|
||||
Lo que se protege aquí no es el aspecto — eso se revisa en el navegador —
|
||||
sino que el rediseño no se haya llevado por delante la autenticación: el
|
||||
formulario real de Odoo, su POST, su csrf_token y su redirect siguen
|
||||
donde estaban, y los errores los sigue escribiendo el servidor.
|
||||
"""
|
||||
|
||||
LOGIN = 'prueba.login@beyond.example'
|
||||
CLAVE = 'clave-de-prueba-login-8'
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
# Cuenta propia: la contraseña de admin depende de cada instalación y
|
||||
# una prueba de autenticación no puede apoyarse en ella.
|
||||
self.usuario = self.env['res.users'].create({
|
||||
'name': 'Prueba Login',
|
||||
'login': self.LOGIN,
|
||||
'password': self.CLAVE,
|
||||
})
|
||||
self.pagina = self.url_open('/web/login')
|
||||
self.assertEqual(self.pagina.status_code, 200)
|
||||
self.html = self.pagina.text
|
||||
|
||||
# -- El formulario real ---------------------------------------------------
|
||||
|
||||
def test_el_post_de_odoo_sigue_intacto(self):
|
||||
"""Un <form> de verdad contra /web/login: Enter envía sin JavaScript."""
|
||||
formulario = re.search(r'<form[^>]*class="[^"]*oe_login_form[^"]*"[^>]*>',
|
||||
self.html)
|
||||
self.assertTrue(formulario, "el formulario de Odoo tiene que seguir ahí")
|
||||
etiqueta = formulario.group(0)
|
||||
self.assertIn('action="/web/login"', etiqueta)
|
||||
self.assertIn('method="post"', etiqueta)
|
||||
|
||||
def test_los_campos_que_lee_el_controlador(self):
|
||||
for campo in ('csrf_token', 'login', 'password', 'type', 'redirect'):
|
||||
self.assertIn(f'name="{campo}"', self.html,
|
||||
f"sin name=\"{campo}\" el controlador no autentica")
|
||||
|
||||
def test_el_csrf_token_va_con_valor(self):
|
||||
token = re.search(r'name="csrf_token" value="([^"]+)"', self.html)
|
||||
self.assertTrue(token and token.group(1),
|
||||
"el csrf_token se renderiza vacío: el POST sería rechazado")
|
||||
|
||||
def test_autocompletado_en_los_dos_campos(self):
|
||||
self.assertIn('autocomplete="username"', self.html)
|
||||
self.assertIn('autocomplete="current-password"', self.html)
|
||||
|
||||
def test_el_formulario_se_ve(self):
|
||||
"""web.login lo trae oculto con d-none y deja que el conmutador de
|
||||
usuarios de Odoo 19 decida. Ese conmutador no se usa (ver la plantilla),
|
||||
así que el formulario no puede quedar escondido."""
|
||||
self.assertNotIn('web.user_switch', self.html)
|
||||
formulario = re.search(r'<form[^>]*oe_login_form[^>]*>', self.html).group(0)
|
||||
self.assertNotIn('d-none', formulario)
|
||||
|
||||
# -- El diseño ------------------------------------------------------------
|
||||
|
||||
def test_la_pantalla_es_la_del_diseno(self):
|
||||
self.assertIn('class="beyond_login"', self.html)
|
||||
self.assertIn('beyond_login_brand', self.html)
|
||||
self.assertIn('/beyond_base/static/img/logo_login.png', self.html)
|
||||
self.assertIn('Iniciar sesión', self.html)
|
||||
self.assertIn('Tecnología de Collina Systems', self.html)
|
||||
|
||||
def test_sin_el_envoltorio_de_odoo(self):
|
||||
"""Ni la tarjeta de 300px, ni el logo de la compañía encima, ni el pie
|
||||
con «Gestionar bases de datos» y la marca de Odoo."""
|
||||
self.assertNotIn('/web/binary/company_logo', self.html)
|
||||
self.assertNotIn('/web/database/manager', self.html)
|
||||
self.assertNotIn('utm_medium=auth', self.html)
|
||||
|
||||
def test_el_boton_del_ojo_se_anuncia(self):
|
||||
ojo = re.search(r'<button[^>]*beyond_login_eye[^>]*>', self.html)
|
||||
self.assertTrue(ojo, "falta el botón que muestra la contraseña")
|
||||
self.assertIn('type="button"', ojo.group(0),
|
||||
"sin type=button el ojo enviaría el formulario")
|
||||
self.assertIn('aria-label="Mostrar contraseña"', ojo.group(0))
|
||||
self.assertIn('aria-pressed="false"', ojo.group(0))
|
||||
|
||||
def test_el_enlace_de_contrasena_apunta_a_la_ruta_real(self):
|
||||
"""Es el interruptor de auth_signup, no un adorno: encendido en
|
||||
Ajustes, el enlace existe y lleva a /web/reset_password."""
|
||||
habilitado = self.env['ir.config_parameter'].sudo().get_param(
|
||||
'auth_signup.reset_password')
|
||||
if habilitado:
|
||||
self.assertIn('/web/reset_password', self.html)
|
||||
self.assertIn('¿Olvidaste tu contraseña?', self.html)
|
||||
else:
|
||||
self.assertNotIn('/web/reset_password', self.html)
|
||||
|
||||
def test_sin_alta_por_cuenta_propia(self):
|
||||
"""A Beyond se entra dado de alta por la administración (ADR-008)."""
|
||||
self.assertNotIn('/web/signup', self.html)
|
||||
|
||||
def test_el_logo_pesa_lo_que_debe(self):
|
||||
"""1.2 MB delante de la sesión es inaceptable; el techo es 100 KB."""
|
||||
self.assertTrue(os.path.exists(LOGO_PATH))
|
||||
self.assertLess(os.path.getsize(LOGO_PATH), 100 * 1024)
|
||||
servido = self.url_open('/beyond_base/static/img/logo_login.png')
|
||||
self.assertEqual(servido.status_code, 200)
|
||||
|
||||
# -- Los mensajes los escribe el servidor ---------------------------------
|
||||
|
||||
def _entrar(self, login, password):
|
||||
csrf = re.search(r'name="csrf_token" value="([^"]+)"', self.html).group(1)
|
||||
return self.url_open('/web/login', allow_redirects=False, data={
|
||||
'login': login,
|
||||
'password': password,
|
||||
'csrf_token': csrf,
|
||||
'type': 'password',
|
||||
'redirect': '',
|
||||
})
|
||||
|
||||
def test_credenciales_malas_muestran_el_error_de_odoo(self):
|
||||
respuesta = self._entrar(self.LOGIN, 'esta-no-es-la-contrasena')
|
||||
self.assertEqual(respuesta.status_code, 200, "se queda en el login")
|
||||
self.assertIn('beyond_login_error', respuesta.text,
|
||||
"el mensaje del servidor se pinta con el estilo del diseño")
|
||||
self.assertNotIn('alert alert-danger', respuesta.text,
|
||||
"la caja de alerta de Bootstrap no debe sobrevivir")
|
||||
# El texto es el de Odoo, no uno inventado por la pantalla.
|
||||
error = re.search(r'class="beyond_login_error"[^>]*>(.*?)</p>',
|
||||
respuesta.text, re.S)
|
||||
self.assertTrue(error and error.group(1).strip(),
|
||||
"el hueco del error está vacío")
|
||||
|
||||
def test_credenciales_buenas_redirigen(self):
|
||||
"""No hay pantalla de «Bienvenido»: Odoo redirige y el usuario cae en
|
||||
el Menú Principal."""
|
||||
respuesta = self._entrar(self.LOGIN, self.CLAVE)
|
||||
self.assertIn(respuesta.status_code, (302, 303),
|
||||
"una autenticación correcta sale del login redirigiendo")
|
||||
self.assertNotIn('Bienvenido,', respuesta.text)
|
||||
@@ -0,0 +1,74 @@
|
||||
# Part of Beyond. Collina Systems proprietary module.
|
||||
from odoo.tests import HttpCase, tagged
|
||||
|
||||
from odoo.addons.beyond_base.models.res_users import (
|
||||
ALTA_SOLO_POR_INVITACION, PARAMETRO_ALTA)
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestBeyondAltaPublica(HttpCase):
|
||||
"""El alta pública está cerrada, y lo está por datos del módulo.
|
||||
|
||||
Quitar el enlace de la pantalla de inicio de sesión no cierra nada: la
|
||||
ruta /web/signup seguía respondiendo a cualquiera que teclease la URL,
|
||||
porque auth_signup se instala con invitation_scope en 'b2c'. El candado
|
||||
vive en data/signup.xml y se reafirma en cada actualización, para que no
|
||||
dependa de un clic en Ajustes ni se pierda al clonar la base.
|
||||
"""
|
||||
|
||||
def _parametro(self):
|
||||
return self.env['ir.config_parameter'].sudo().get_param(PARAMETRO_ALTA)
|
||||
|
||||
def test_el_candado_quedo_puesto(self):
|
||||
self.assertEqual(self._parametro(), ALTA_SOLO_POR_INVITACION)
|
||||
|
||||
def test_el_candado_se_repone_solo(self):
|
||||
"""Alguien lo abre desde Ajustes; la siguiente actualización lo cierra."""
|
||||
self.env['ir.config_parameter'].sudo().set_param(PARAMETRO_ALTA, 'b2c')
|
||||
self.env['res.users']._beyond_cerrar_alta_publica()
|
||||
self.assertEqual(self._parametro(), ALTA_SOLO_POR_INVITACION)
|
||||
|
||||
def test_es_idempotente(self):
|
||||
"""Cerrado y vuelto a cerrar, no escribe ni cambia nada."""
|
||||
self.env['res.users']._beyond_cerrar_alta_publica()
|
||||
self.env['res.users']._beyond_cerrar_alta_publica()
|
||||
self.assertEqual(self._parametro(), ALTA_SOLO_POR_INVITACION)
|
||||
|
||||
# -- La ruta ---------------------------------------------------------------
|
||||
|
||||
def test_signup_sin_invitacion_no_existe(self):
|
||||
"""Con el candado puesto, Odoo ni siquiera sirve el formulario."""
|
||||
respuesta = self.url_open('/web/signup', allow_redirects=False)
|
||||
self.assertEqual(respuesta.status_code, 404,
|
||||
"/web/signup sigue abierta a cualquiera con la URL")
|
||||
|
||||
def test_no_se_puede_registrar_sin_invitacion(self):
|
||||
"""Y un POST directo, saltándose el formulario, tampoco crea cuenta."""
|
||||
correo = 'intruso@beyond.example'
|
||||
pagina = self.url_open('/web/login')
|
||||
csrf = pagina.text.split('name="csrf_token" value="')[1].split('"')[0]
|
||||
respuesta = self.url_open('/web/signup', allow_redirects=False, data={
|
||||
'login': correo,
|
||||
'name': 'Intruso',
|
||||
'password': 'una-contrasena-cualquiera',
|
||||
'confirm_password': 'una-contrasena-cualquiera',
|
||||
'csrf_token': csrf,
|
||||
})
|
||||
self.assertEqual(respuesta.status_code, 404)
|
||||
self.assertFalse(
|
||||
self.env['res.users'].sudo().with_context(active_test=False).search(
|
||||
[('login', '=', correo)]),
|
||||
"se creó una cuenta sin invitación")
|
||||
|
||||
def test_el_alta_con_invitacion_sigue_viva(self):
|
||||
"""El candado cierra la puerta de la calle, no la del aprovisionador:
|
||||
el alta por invitación (ADR-008) tiene que seguir funcionando."""
|
||||
usuario = self.env['res.users'].create({
|
||||
'name': 'Invitada Beyond',
|
||||
'login': 'invitada@beyond.example',
|
||||
})
|
||||
usuario.partner_id.signup_prepare()
|
||||
token = usuario.partner_id.sudo()._generate_signup_token()
|
||||
respuesta = self.url_open('/web/signup?token=%s' % token)
|
||||
self.assertEqual(respuesta.status_code, 200,
|
||||
"una invitación válida dejó de servir el formulario")
|
||||
@@ -0,0 +1,188 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<!--
|
||||
Beyond — login v1.
|
||||
|
||||
The signed-off "Iniciar sesión" screen, built by inheriting web.login
|
||||
and web.login_layout. No core file is touched and no controller is
|
||||
overridden: the form that posts to /web/login is Odoo's own, kept whole
|
||||
with its action, its method, its csrf_token and its redirect. What
|
||||
changes is the markup around the fields and the shell it renders in.
|
||||
|
||||
Both templates carry priority="99" so they are the LAST arch applied to
|
||||
web.login. auth_signup and auth_passkey also inherit it, and the order
|
||||
has to be a decision rather than a coincidence of module ids: this file
|
||||
replaces the block that auth_signup drops its "Restablecer contraseña"
|
||||
link into, and it can only do that reliably if the link is already
|
||||
there when it runs. beyond_base depends on auth_signup for the same
|
||||
reason (see __manifest__.py).
|
||||
|
||||
THREE THINGS THE DESIGN ASKS FOR THAT ARE NOT HERE, on purpose:
|
||||
|
||||
1. Live validation. The mock decides on its own that the fields are
|
||||
empty and writes its own message. Here every message is the
|
||||
server's, after the POST — a wrong password is Odoo's string,
|
||||
rendered in the design's voice by scss/../login/beyond_login.scss.
|
||||
The only client-side check left is core's own `required`.
|
||||
|
||||
2. The "Bienvenido, X" screen. There is nothing to build: a correct
|
||||
login is a 303 out of /web/login and the browser lands on the Menú
|
||||
Principal (the launcher, ADR-005). The mock needed that screen
|
||||
because it had nowhere to go.
|
||||
|
||||
3. The eye's own logic. It lives in login/beyond_login.js, because the
|
||||
type of an input is not something a template can toggle.
|
||||
|
||||
AND THREE THINGS THE DESIGN DID NOT KNOW ABOUT, decided here:
|
||||
|
||||
- web.user_switch (Odoo 19) is removed. It is the "Choose a user"
|
||||
screen that hides the form behind the last accounts to log in on this
|
||||
browser. On a shop terminal shared by a shift that is a list of
|
||||
colleagues' names and faces on the pre-session screen, and the design
|
||||
has no such state.
|
||||
- The signup link ("¿No tienes una cuenta?") is removed. Beyond staff
|
||||
are provisioned by the branch administrator (ADR-008); nobody signs
|
||||
themselves up. NOTE this only takes the link off this screen — the
|
||||
/web/signup route stays open until `auth_signup.invitation_scope` is
|
||||
set to b2b in Ajustes.
|
||||
- The passkey block (auth_passkey) STAYS. It is not in the design, but
|
||||
it is a real way in, and removing it would lock out anyone who
|
||||
registered a key. It is restyled, not dropped.
|
||||
-->
|
||||
|
||||
<!--
|
||||
The shell. web.login_layout wraps its content in a centred 300px card
|
||||
with the company logo on top and an "Con la tecnología de Odoo" footer
|
||||
under it. The login screen is a full-bleed two-column page, so on this
|
||||
page the card is not overridden, it is not rendered at all.
|
||||
|
||||
`beyond_login` is set by the template below, inside the body of the
|
||||
t-call — QWeb renders that body first and the t-set reaches here. The
|
||||
other pages that share this layout (restablecer contraseña, alta,
|
||||
sesión iniciada) never set it and are left exactly as they were.
|
||||
-->
|
||||
<template id="login_layout_beyond" inherit_id="web.login_layout" priority="99"
|
||||
name="Beyond — envoltura de inicio de sesión">
|
||||
<xpath expr="//t[@t-set='body_classname']" position="attributes">
|
||||
<attribute name="t-value">'beyond_login_body' if beyond_login else 'bg-100'</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('container')]" position="attributes">
|
||||
<attribute name="t-if">not beyond_login</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('container')]" position="after">
|
||||
<div t-if="beyond_login" class="beyond_login">
|
||||
<div class="beyond_login_brand">
|
||||
<!--
|
||||
Absolute path on purpose: this page precedes the
|
||||
session and resolves nothing through the backend.
|
||||
20 KB PNG, white type on transparency, from the 1.2 MB
|
||||
JPEG the design shipped.
|
||||
-->
|
||||
<img class="beyond_login_logo" alt="Look Capital"
|
||||
src="/beyond_base/static/img/logo_login.png"/>
|
||||
</div>
|
||||
<div class="beyond_login_panel">
|
||||
<div class="beyond_login_stack">
|
||||
<t t-out="0"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- The form itself. -->
|
||||
<template id="login_beyond" inherit_id="web.login" priority="99"
|
||||
name="Beyond — iniciar sesión">
|
||||
|
||||
<!-- Read by the layout above. `disable_footer` takes out the "Gestionar
|
||||
bases de datos" and Odoo branding line under the card. -->
|
||||
<xpath expr="//form[@role='form']" position="before">
|
||||
<t t-set="beyond_login" t-value="True"/>
|
||||
<t t-set="disable_footer" t-value="True"/>
|
||||
<span class="beyond_login_title">Iniciar sesión</span>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//form[@role='form']" position="after">
|
||||
<span class="beyond_login_sign">Tecnología de Collina Systems</span>
|
||||
</xpath>
|
||||
|
||||
<!-- See note 1 at the top of this file. -->
|
||||
<xpath expr="//owl-component[@name='web.user_switch']" position="replace"/>
|
||||
|
||||
<!-- Core hides the form with `d-none` and lets the user switcher decide
|
||||
whether to show it. With the switcher gone the form is the screen,
|
||||
so the class stops being computed. -->
|
||||
<xpath expr="//form[@role='form']" position="attributes">
|
||||
<attribute name="t-attf-class"/>
|
||||
<attribute name="class">oe_login_form beyond_login_form</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[hasclass('field-login')]" position="replace">
|
||||
<div class="beyond_login_field">
|
||||
<div class="beyond_login_field_head">
|
||||
<label for="login" class="beyond_login_label">Nombre de usuario</label>
|
||||
</div>
|
||||
<!-- name="login" is what /web/login reads. The design calls it
|
||||
"Nombre de usuario" because that is what the staff type;
|
||||
Odoo accepts the login, mail or not. -->
|
||||
<input type="text" name="login" id="login" class="beyond_login_input"
|
||||
t-att-value="login" placeholder="Usuario"
|
||||
required="required" autocapitalize="off" autocomplete="username"
|
||||
t-att-autofocus="'autofocus' if not login else None"/>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
<!-- The o_caps_lock_warning class rides along: core's interaction hangs
|
||||
its "¡Bloq Mayús está activado!" off it, which is worth keeping on
|
||||
a screen where you type blind. -->
|
||||
<xpath expr="//div[hasclass('o_caps_lock_warning')]" position="replace">
|
||||
<div class="beyond_login_field o_caps_lock_warning">
|
||||
<div class="beyond_login_field_head">
|
||||
<label for="password" class="beyond_login_label">Contraseña</label>
|
||||
<!-- The real reset route, behind the real switch: Ajustes →
|
||||
"Restablecer contraseña" (auth_signup.reset_password).
|
||||
Off, and the link is not rendered — the same condition
|
||||
core uses, only the copy is the design's. -->
|
||||
<a t-if="reset_password_enabled" class="beyond_login_forgot"
|
||||
t-attf-href="/web/reset_password?{{ keep_query() }}">¿Olvidaste tu contraseña?</a>
|
||||
</div>
|
||||
<div class="beyond_login_pw">
|
||||
<input type="password" name="password" id="password"
|
||||
class="beyond_login_input_pw" placeholder="••••••••••"
|
||||
required="required" autocomplete="current-password"
|
||||
maxlength="4096"
|
||||
t-att-autofocus="'autofocus' if login else None"/>
|
||||
<button type="button" class="beyond_login_eye"
|
||||
aria-label="Mostrar contraseña" aria-pressed="false">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
||||
<path d="M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"
|
||||
stroke="currentColor" stroke-width="2"/>
|
||||
<circle cx="12" cy="12" r="3.2" stroke="currentColor" stroke-width="2"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
<!-- The server's own messages, stripped of Bootstrap's alert box so the
|
||||
design's 14px/700 can show. The text and the t-if stay core's. -->
|
||||
<xpath expr="//p[hasclass('alert-danger')]" position="attributes">
|
||||
<attribute name="class">beyond_login_error</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//p[hasclass('alert-success')]" position="attributes">
|
||||
<attribute name="class">beyond_login_message</attribute>
|
||||
</xpath>
|
||||
|
||||
<!-- oe_login_buttons is kept in the class list: auth_signup and
|
||||
auth_passkey both hang their arch off it. -->
|
||||
<xpath expr="//div[hasclass('oe_login_buttons')]" position="attributes">
|
||||
<attribute name="class">oe_login_buttons beyond_login_actions</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('oe_login_buttons')]/button[@type='submit']" position="attributes">
|
||||
<attribute name="class">beyond_login_submit</attribute>
|
||||
</xpath>
|
||||
|
||||
<!-- See the third note at the top of this file. -->
|
||||
<xpath expr="//a[contains(@t-attf-href, '/web/signup')]" position="replace"/>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in new issue
Block a user