Files
rsu-new-site/frontend/chunk-VBOHFQOD.js

2 lines
5.3 KiB
JavaScript

import{a as N}from"./chunk-SMVD5LRJ.js";import{c as P,d as R,e as j,f as k,g as D,h as V,p as A,t as T}from"./chunk-UDFQV3WY.js";import{c as M,e as L,f as E,i as I}from"./chunk-ZEULGWAI.js";import"./chunk-MBEC6LK4.js";import{Eb as a,Fa as n,Fb as b,Gb as x,Jb as h,Kb as v,Lb as w,Oa as u,Ta as y,Ya as S,ca as l,jb as m,kb as t,lb as r,mb as c,rb as g,rc as C,sb as f,xc as _}from"./chunk-TVKQFRWX.js";import"./chunk-DAQOROHW.js";function W(s,o){if(s&1&&(t(0,"div",21),a(1),r()),s&2){let i=f();n(),b(i.error())}}function z(s,o){if(s&1&&(t(0,"div",22),a(1),r()),s&2){let i=f();n(),b(i.success())}}var q=class s{constructor(o,i,e){this.authService=o;this.router=i;this.route=e;this.route.snapshot.queryParamMap.get("passwordChanged")==="1"&&this.success.set("Votre mot de passe a \xE9t\xE9 modifi\xE9. Connectez-vous avec votre nouveau mot de passe.")}username="";password="";loading=l(!1);error=l("");success=l("");showPassword=l(!1);onSubmit(){if(!this.username||!this.password){this.error.set("Veuillez remplir tous les champs.");return}this.loading.set(!0),this.error.set(""),this.authService.login({username:this.username,password:this.password}).subscribe({next:o=>{if(o.success){let i=o.data?.mustChangePassword?"/auth/change-password":this.route.snapshot.queryParams.returnUrl||"/admin";this.router.navigateByUrl(i)}else this.error.set(o.message||"Erreur de connexion.");this.loading.set(!1)},error:o=>{this.error.set(o.error?.message||"Identifiants incorrects."),this.loading.set(!1)}})}static \u0275fac=function(i){return new(i||s)(u(N),u(L),u(M))};static \u0275cmp=y({type:s,selectors:[["app-login"]],decls:30,vars:8,consts:[[1,"relative","flex","min-h-screen","items-center","justify-center","overflow-hidden","bg-primary-950","px-5","py-12"],[1,"absolute","inset-0","bg-gradient-to-br","from-primary-950","via-primary-800","to-accent-700","opacity-95"],[1,"relative","w-full","max-w-md"],["routerLink","/","aria-label","Retour au site public",1,"mx-auto","mb-7","flex","w-fit","items-center","justify-center"],[1,"flex","h-28","w-32","items-center","justify-center","rounded-2xl","bg-white","p-2","shadow-xl"],["src","assets/images/rsu-logo.jpg","alt","Logo du Registre Social Unique",1,"h-full","w-full","object-contain"],[1,"rounded-3xl","border","border-white/15","bg-white","p-8","shadow-2xl"],[1,"text-center","text-2xl","font-bold","text-slate-900"],[1,"mt-2","text-center","text-sm","text-slate-500"],["class","mt-6 rounded-xl border border-red-200 bg-red-50 p-4 text-sm text-red-700",4,"ngIf"],["class","mt-6 rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-700",4,"ngIf"],[1,"mt-7","space-y-5",3,"ngSubmit"],["for","username",1,"block","text-sm","font-semibold","text-slate-700"],["id","username","type","text","name","username","required","","autocomplete","username","placeholder","Votre nom d\u2019utilisateur",1,"mt-2","w-full","rounded-xl","border","border-slate-300","px-4","py-3","outline-none","transition","focus:border-primary-600","focus:ring-2","focus:ring-primary-100",3,"ngModelChange","ngModel"],["for","password",1,"block","text-sm","font-semibold","text-slate-700"],[1,"relative","mt-2"],["id","password","name","password","required","","autocomplete","current-password","placeholder","Votre mot de passe",1,"w-full","rounded-xl","border","border-slate-300","px-4","py-3","pr-14","outline-none","transition","focus:border-primary-600","focus:ring-2","focus:ring-primary-100",3,"ngModelChange","type","ngModel"],["type","button",1,"absolute","inset-y-0","right-0","px-4","text-xs","font-bold","text-primary-700",3,"click"],["type","submit",1,"w-full","rounded-xl","bg-primary-700","py-3.5","font-semibold","text-white","transition","hover:bg-primary-800","disabled:cursor-wait","disabled:opacity-60",3,"disabled"],[1,"mt-6","border-t","border-slate-100","pt-5","text-center","text-sm","text-slate-500"],["routerLink","/",1,"font-semibold","text-primary-700","hover:text-primary-800"],[1,"mt-6","rounded-xl","border","border-red-200","bg-red-50","p-4","text-sm","text-red-700"],[1,"mt-6","rounded-xl","border","border-emerald-200","bg-emerald-50","p-4","text-sm","text-emerald-700"]],template:function(i,e){i&1&&(t(0,"div",0),c(1,"div",1),t(2,"div",2)(3,"a",3)(4,"span",4),c(5,"img",5),r()(),t(6,"div",6)(7,"h1",7),a(8,"Connexion"),r(),t(9,"p",8),a(10,"G\xE9rez les articles, documents et autres contenus du site."),r(),S(11,W,2,1,"div",9)(12,z,2,1,"div",10),t(13,"form",11),g("ngSubmit",function(){return e.onSubmit()}),t(14,"div")(15,"label",12),a(16,"Nom d\u2019utilisateur"),r(),t(17,"input",13),w("ngModelChange",function(d){return v(e.username,d)||(e.username=d),d}),r()(),t(18,"div")(19,"label",14),a(20,"Mot de passe"),r(),t(21,"div",15)(22,"input",16),w("ngModelChange",function(d){return v(e.password,d)||(e.password=d),d}),r(),t(23,"button",17),g("click",function(){return e.showPassword.set(!e.showPassword())}),a(24),r()()(),t(25,"button",18),a(26),r()(),t(27,"p",19)(28,"a",20),a(29,"\u2190 Retour au site public"),r()()()()()),i&2&&(n(11),m("ngIf",e.error()),n(),m("ngIf",e.success()),n(5),h("ngModel",e.username),n(5),m("type",e.showPassword()?"text":"password"),h("ngModel",e.password),n(2),x(" ",e.showPassword()?"Cacher":"Voir"," "),n(),m("disabled",e.loading()),n(),x(" ",e.loading()?"Connexion en cours\u2026":"Se connecter"," "))},dependencies:[_,C,I,E,T,V,P,R,j,A,D,k],encapsulation:2})};export{q as LoginComponent};