PageSourceSearch

https://snich.ai/assets/LoginScreen-e8a81593.js

js snich.ai collected 2026-10-05 15:07:25 UTC 5,670 bytes, 1 lines download raw bytes

1import{a as k,r as t,j as e,b as M,L as O}from"./vendor-react-72e4a099.js";import{f as V,B as b,F as R,I,P as G}from"./Toast-43ee7788.js";import{a as L,A as w,e as B}from"./api-d8a57490.js";import{u as H,s as U}from"./buildLifecycle-a44b0e05.js";import{u as q,O as z,A as J,L as A,a as T,b as Y,c as _,d as N,G as $,E as K}from"./AuthShell-619b6fc9.js";import{Y as Q,V as W}from"./VkButton-d7173e86.js";import{p as X}from"./JoinByLinkModal-119f67b7.js";import{L as Z}from"./link-2-36909ef8.js";import{A as ee}from"./arrow-right-eda8f931.js";import"./createLucideIcon-581cd729.js";import"./eye-5711d0dd.js";import"./x-b9f3d093.js";import"./circle-check-63b159d4.js";import"./circle-alert-67975319.js";import"./Display-48adcc24.js";import"./promo-speaker-89d1d1d0.js";/* empty css               */import"./chevron-right-b4336544.js";import"./arrow-up-955249b3.js";import"./heart-469df115.js";import"./thumbs-up-f55ea202.js";function se({open:r,onClose:c}){const x=k(),[p,n]=t.useState(""),[h,i]=t.useState(null),[j,m]=t.useState(!1);t.useEffect(()=>{r&&(n(""),i(null),m(!1))},[r]);const g=async o=>{o==null||o.preventDefault();const l=X(p);if(!l){i("Вставьте ссылку из приглашения или код из письма");return}if("path"in l){c(),x(l.path);return}m(!0),i(null);try{const s=await L.get("/api/v1/public/resolve-code",{query:{code:l.code},anonymous:!0});if(!(s!=null&&s.path))throw new w("not found",404);c(),x(s.path)}catch(s){i(s instanceof w&&(s.status===404||s.status===400)?"Не нашли эфир или встречу по этому коду. Проверьте ссылку в письме.":B(s,"Не получилось открыть ссылку. Попробуйте ещё раз."))}finally{m(!1)}};return e.jsx(V,{open:r,onClose:c,title:"Войти как гость",subtitle:"Вставьте ссылку на эфир или встречу из приглашения — аккаунт не нужен",icon:e.jsx(Z,{className:"sn-i sn-i-20"}),width:520,className:"sn-a-ui",footer:e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{flex:1}}),e.jsx(b,{variant:"quiet",onClick:c,children:"Отмена"}),e.jsx(b,{variant:"primary",loading:j,disabled:!p.trim(),iconRight:e.jsx(ee,{className:"sn-i sn-i-16"}),onClick:()=>g(),children:"Перейти"})]}),children:e.jsx("form",{onSubmit:g,children:e.jsx(R,{label:"Ссылка или код",error:h||void 0,htmlFor:"guest-join-input",hint:h?void 0:"Например, snich.ai/e/… или код вида stage-4k2p",children:e.jsx(I,{id:"guest-join-input","data-autofocus":!0,value:p,onChange:o=>{n(o.target.value),i(null)},placeholder:"Ссылка из письма или код",invalid:!!h,autoComplete:"off"})})})})}function Ee(){const[r,c]=M(),x=k(),{login:p}=H(),n=U(r.get("next")),h=n==="/dashboard"?"":n,[i,j]=t.useState(()=>r.get("email")||""),[m,g]=t.useState(""),[o,l]=t.useState({}),[s,f]=t.useState(null),[C,y]=t.useState(!1),[P,E]=t.useState(!1),F=q(n),S=t.useMemo(()=>r.get("reset")==="1"?"Пароль изменён. Войдите с новым паролем.":null,[r]);t.useEffect(()=>{const u=r.get("error");if(!u)return;f(z[u]||"Не удалось войти. Попробуйте ещё раз.");const a=new URLSearchParams(r);a.delete("error"),c(a,{replace:!0})},[r,c]);const D=async u=>{u.preventDefault();const a={},v=i.trim();if(v?K.test(v)||(a.email="Проверьте email — в нём ошибка"):a.email="Укажите email",m||(a.password="Введите пароль"),l(a),f(null),!(a.email||a.password)){y(!0);try{const d=await L.post("/api/v1/auth/login",{email:v,password:m},{anonymous:!0});p(d.token,d.user),x(n,{replace:!0})}catch(d){d instanceof w&&(d.status===401||d.status===400)?f("Неверный email или пароль"):f(B(d,"Не удалось войти. Попробуйте ещё раз.")),y(!1)}}};return F?null:e.jsxs(J,{footer:e.jsxs("p",{className:"sn-a-auth-foot",children:["Продолжая, вы принимаете ",e.jsx(A,{kind:"terms",className:"sn-a-auth-legal"})," и ",e.jsx(A,{kind:"privacy",className:"sn-a-auth-legal"})]}),children:[e.jsx(T,{title:"Вход в SNICH",subtitle:"Роль выбирать не нужно — она зависит от события"}),e.jsx(Y,{current:"login",next:h}),e.jsxs("div",{className:"sn-a-auth-oauth",children:[e.jsx(Q,{label:"Войти с Яндекс ID",next:n,onError:f}),e.jsx(W,{label:"Войти через VK ID",next:n})]}),e.jsx(_,{}),e.jsxs("form",{className:"sn-a-auth-form",onSubmit:D,noValidate:!0,children:[S&&!s&&e.jsx(N,{tone:"info",children:S}),s&&e.jsx(N,{children:s}),e.jsx(R,{label:"Email",htmlFor:"login-email",error:o.email,children:e.jsx(I,{id:"login-email",type:"email",name:"email",placeholder:"[email protected]",autoComplete:"email",value:i,invalid:!!o.email,onChange:u=>{j(u.target.value),l(a=>({...a,email:void 0}))}})}),e.jsxs("div",{className:"sn-field",children:[e.jsxs("div",{className:"sn-a-auth-labelrow",children:[e.jsx("label",{className:"sn-label",htmlFor:"login-pass",children:"Пароль"}),e.jsx(O,{to:`/forgot-password${i.trim()?`?email=${encodeURIComponent(i.trim())}`:""}`,children:"Забыли пароль?"})]}),e.jsx(G,{id:"login-pass",name:"password",autoComplete:"current-password",placeholder:"Ваш пароль",value:m,invalid:!!o.password,onChange:u=>{g(u.target.value),l(a=>({...a,password:void 0}))}}),o.password&&e.jsx("span",{className:"sn-error",role:"alert",children:o.password})]}),e.jsx(b,{type:"submit",variant:"primary",size:"lg",loading:C,children:"Войти"})]}),e.jsx($,{onClick:()=>E(!0)}),e.jsx(se,{open:P,onClose:()=>E(!1)})]})}export{Ee as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.