The student app's login page offers Microsoft 365 when the provider is configured, /auth/oauth/callback redeems the one-time code, a consent screen finishes a first sign-in, the profile attaches Microsoft through a link ticket, and the service worker leaves /oauth alone. The build also carries the summer presentation theme already committed in the frontend sources.
2 lines
2.7 KiB
JavaScript
2 lines
2.7 KiB
JavaScript
import{d as C,u as q,o as z,a as N,c as o,b as s,e as U,f as i,t as p,w as y,v as w,g as Z,h as B,i as g,j as k,k as S,r as a,l as A,m as I,n as l,p as _}from"./index-DmTksCHf.js";import{s as h,f as R}from"./forms-X1As8WqF.js";import{o as T}from"./oauth-zzthF4BZ.js";const D={class:"auth"},E={key:0,class:"notice",role:"status"},L={key:0,class:"notice error",role:"alert",style:{"margin-bottom":"14px"}},P={class:"field"},W={key:0,class:"error-text"},H={class:"field"},F={key:0,class:"error-text"},G={class:"check",style:{"margin-bottom":"16px"}},J=["disabled"],K={class:"auth-links"},$=C({__name:"LoginView",setup(O){const x=q(),c=S(),j=I(),n=a(""),u=a(""),v=a(!0),d=a(!1),t=a(null),f=a(!1);z(async()=>{try{const m=await N.oauthProviders();f.value=m.providers.some(e=>e.name==="microsoft")}catch{f.value=!1}});function V(){window.location.assign(T("microsoft",{action:"login",returnTo:h(c.query.redirect)}))}async function M(){d.value=!0,t.value=null;try{await x.login(n.value.trim(),u.value,v.value),await j.replace(h(c.query.redirect))}catch(m){t.value=R(m)}finally{d.value=!1}}return(m,e)=>{const b=A("router-link");return l(),o("div",D,[e[8]||(e[8]=s("header",{class:"page-head"},[s("span",{class:"eyebrow"},"BM II° · UWr"),s("h1",null,"Zaloguj się")],-1)),U(c).query.expired?(l(),o("p",E,"Sesja wygasła. Zaloguj się ponownie.")):i("",!0),s("form",{onSubmit:B(M,["prevent"]),novalidate:""},[t.value?.message?(l(),o("div",L,p(t.value.message),1)):i("",!0),s("div",P,[e[3]||(e[3]=s("label",{for:"email"},"Adres e-mail",-1)),y(s("input",{id:"email","onUpdate:modelValue":e[0]||(e[0]=r=>n.value=r),type:"email",autocomplete:"username",inputmode:"email",required:"",autofocus:""},null,512),[[w,n.value]]),t.value?.fields.email?(l(),o("p",W,p(t.value.fields.email),1)):i("",!0)]),s("div",H,[e[4]||(e[4]=s("label",{for:"password"},"Hasło",-1)),y(s("input",{id:"password","onUpdate:modelValue":e[1]||(e[1]=r=>u.value=r),type:"password",autocomplete:"current-password",required:""},null,512),[[w,u.value]]),t.value?.fields.password?(l(),o("p",F,p(t.value.fields.password),1)):i("",!0)]),s("label",G,[y(s("input",{"onUpdate:modelValue":e[2]||(e[2]=r=>v.value=r),type:"checkbox"},null,512),[[Z,v.value]]),e[5]||(e[5]=s("span",null,"Pamiętaj mnie na tym urządzeniu",-1))]),s("button",{class:"btn primary block",type:"submit",disabled:d.value||!n.value||!u.value},p(d.value?"Logowanie…":"Zaloguj się"),9,J)],32),f.value?(l(),o("button",{key:1,class:"btn block",type:"button",style:{"margin-top":"12px"},onClick:V},"Zaloguj przez Microsoft 365")):i("",!0),s("div",K,[g(b,{to:"/przypomnij-haslo"},{default:k(()=>[...e[6]||(e[6]=[_("Nie pamiętam hasła",-1)])]),_:1}),g(b,{to:"/rejestracja"},{default:k(()=>[...e[7]||(e[7]=[_("Załóż konto",-1)])]),_:1})])])}}});export{$ as default};
|