PageSourceSearch

https://mbstu.ac.bd/build/assets/SettingsView-DAVhXXya.js

js mbstu.ac.bd collected 2026-09-24 21:25:11 UTC 6,851 bytes, 1 lines download raw bytes

1import{d as C,r as n,E as q,y as f,o as N,h as j,a as c,i as M,f as t,b,c as w,e as F,s as R,j as p,v,u as g,t as x,k as V}from"./app-CKAcpjBV.js";import{_ as X}from"./BreadcrumbDefault.vue_vue_type_script_setup_true_lang-CzPdQsaV.js";import{_ as E}from"./DefaultLayout.vue_vue_type_script_setup_true_lang-CARaw083.js";import{u as U}from"./useToast-l3VtWTrw.js";import{S as _}from"./save-DoJycc8S.js";/* empty css            */import"./HeaderArea.vue_vue_type_script_setup_true_lang-D1RHVwo1.js";import"./index-BLRDgKr4.js";import"./useDefaultImages-Ci2HP7qX.js";import"./createLucideIcon-Df3IFRix.js";const B={class:"mx-auto max-w-270"},L={class:"rounded-sm border border-stroke bg-white shadow-default dark:border-strokedark dark:bg-boxdark"},H={class:"p-6"},W={key:0,class:"mb-4 rounded border border-stroke p-4 dark:border-strokedark"},A={class:"md:col-span-3 flex justify-end"},D=["disabled"],J={key:1,class:"rounded border border-stroke p-4 dark:border-strokedark"},K={class:"flex items-center justify-between gap-4"},$={class:"inline-flex cursor-pointer items-center"},G=["disabled"],z={class:"mt-4 flex justify-end"},I=["disabled"],Q={key:2,class:"text-sm text-gray-500"},le=C({__name:"SettingsView",setup(Y){const h=n("Settings"),r=U(),S=q(),y=f(()=>(S.props?.auth?.user?.role_name||"").toString().toLowerCase()),m=f(()=>["faculty","department admin","university admin","admin"].includes(y.value)),k=f(()=>["department admin","university admin","admin","faculty"].includes(y.value)),i=n(!1),l=n(!1),d=n(!1),u=n(!1),s=n({current_password:"",new_password:"",new_password_confirmation:""}),T=async()=>{if(m.value){l.value=!0;try{const a=await fetch("/admin/security/otp",{method:"GET",credentials:"include",headers:{"X-Requested-With":"XMLHttpRequest"}}),e=await a.json();if(a.ok&&e?.success){i.value=!!e.otp_enabled;return}r.error(e?.message||"Failed to load OTP setting.")}catch{r.error("Failed to load OTP setting.")}finally{l.value=!1}}},P=async()=>{if(m.value){d.value=!0;try{const a=await fetch("/admin/security/otp",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]')?.getAttribute("content")||"","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({otp_enabled:i.value})}),e=await a.json();if(a.ok&&e?.success){r.success(e?.message||"OTP setting updated successfully.");return}r.error(e?.message||"Failed to update OTP setting.")}catch{r.error("Failed to update OTP setting.")}finally{d.value=!1}}},O=async()=>{if(k.value){if(s.value.new_password!==s.value.new_password_confirmation){r.error("New password confirmation does not match.");return}u.value=!0;try{const a=await fetch("/admin/security/password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":document.querySelector('meta[name="csrf-token"]')?.getAttribute("content")||"","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify(s.value)}),e=await a.json();if(a.ok&&e?.success){r.success(e?.message||"Password updated successfully."),s.value.current_password="",s.value.new_password="",s.value.new_password_confirmation="";return}r.error(e?.message||"Failed to update password.")}catch{r.error("Failed to update password.")}finally{u.value=!1}}};return N(()=>{T()}),(a,e)=>(c(),j(E,null,{default:M(()=>[t("div",B,[b(X,{pageTitle:h.value},null,8,["pageTitle"]),t("div",L,[e[10]||(e[10]=t("div",{class:"border-b border-stroke px-6 py-4 dark:border-strokedark"},[t("h3",{class:"font-semibold text-black dark:text-white"},"Security"),t("p",{class:"mt-1 text-sm text-gray-600 dark:text-gray-400"}," Manage account sign-in security settings. ")],-1)),t("div",H,[k.value?(c(),w("div",W,[e[7]||(e[7]=t("h4",{class:"mb-3 text-sm font-semibold text-black dark:text-white"},"Change Password",-1)),t("form",{class:"grid grid-cols-1 gap-4 md:grid-cols-3",onSubmit:R(O,["prevent"])},[t("div",null,[e[4]||(e[4]=t("label",{class:"mb-2 block text-xs font-medium text-black dark:text-white"},"Current Password",-1)),p(t("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>s.value.current_password=o),type:"password",required:"",autocomplete:"current-password",class:"w-full rounded border border-stroke px-3 py-2 text-sm focus:border-primary focus:outline-none dark:border-strokedark dark:bg-boxdark"},null,512),[[v,s.value.current_password]])]),t("div",null,[e[5]||
1(e[5]=t("label",{class:"mb-2 block text-xs font-medium text-black dark:text-white"},"New Password",-1)),p(t("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>s.value.new_password=o),type:"password",required:"",minlength:"6",autocomplete:"new-password",class:"w-full rounded border border-stroke px-3 py-2 text-sm focus:border-primary focus:outline-none dark:border-strokedark dark:bg-boxdark"},null,512),[[v,s.value.new_password]])]),t("div",null,[e[6]||(e[6]=t("label",{class:"mb-2 block text-xs font-medium text-black dark:text-white"},"Confirm New Password",-1)),p(t("input",{"onUpdate:modelValue":e[2]||(e[2]=o=>s.value.new_password_confirmation=o),type:"password",required:"",minlength:"6",autocomplete:"new-password",class:"w-full rounded border border-stroke px-3 py-2 text-sm focus:border-primary focus:outline-none dark:border-strokedark dark:bg-boxdark"},null,512),[[v,s.value.new_password_confirmation]])]),t("div",A,[t("button",{type:"submit",disabled:u.value,class:"hover:bg-opacity-90 inline-flex items-center justify-center gap-2 rounded bg-primary px-5 py-2.5 font-medium text-white transition disabled:cursor-not-allowed disabled:opacity-50"},[b(g(_),{class:"h-4 w-4"}),t("span",null,x(u.value?"Saving...":"Update Password"),1)],8,D)])],32)])):F("",!0),m.value?(c(),w("div",J,[t("div",K,[e[9]||(e[9]=t("div",null,[t("p",{class:"text-sm font-medium text-black dark:text-white"},"Enable OTP on sign in"),t("p",{class:"mt-1 text-xs text-gray-500"},"OTP is valid for 3 minutes. New OTP can be requested after 3 minutes.")],-1)),t("label",$,[p(t("input",{"onUpdate:modelValue":e[3]||(e[3]=o=>i.value=o),type:"checkbox",class:"peer sr-only",disabled:l.value||d.value},null,8,G),[[V,i.value]]),e[8]||(e[8]=t("div",{class:"peer relative h-6 w-11 rounded-full bg-gray-300 transition after:absolute after:start-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white after:transition-all peer-checked:bg-primary peer-checked:after:translate-x-full"},null,-1))])]),t("div",z,[t("button",{type:"button",disabled:l.value||d.value,class:"hover:bg-opacity-90 inline-flex items-center justify-center gap-2 rounded bg-primary px-5 py-2.5 font-medium text-white transition disabled:cursor-not-allowed disabled:opacity-50",onClick:P},[b(g(_),{class:"h-4 w-4"}),t("span",null,x(d.value?"Saving...":"Save"),1)],8,I)])])):(c(),w("p",Q," OTP security settings are only available for faculty, university, and department account flows. "))])])])]),_:1}))}});export{le 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.