Files
Gnuboard7/templates/_bundled/sirsoft-basic/layouts/mypage/change-password.json
T
2026-04-01 10:30:52 +09:00

369 lines
16 KiB
JSON

{
"version": "1.0.0",
"layout_name": "mypage/change-password",
"extends": "_user_base",
"permissions": [],
"data_sources": [],
"init_actions": [
{
"handler": "setState",
"params": {
"target": "local",
"isSubmitting": false,
"success": false
}
}
],
"slots": {
"content": [
{
"type": "basic",
"name": "Div",
"props": {
"className": "min-h-[60vh] flex items-center justify-center py-12 px-4"
},
"children": [
{
"type": "basic",
"name": "Div",
"props": {
"className": "w-full max-w-md"
},
"children": [
{
"type": "basic",
"name": "Div",
"props": {
"className": "bg-white dark:bg-gray-800 rounded-lg shadow-md p-8"
},
"responsive": {
"portable": {
"props": {
"className": "bg-white dark:bg-gray-800 rounded-lg shadow-md p-6"
}
}
},
"children": [
{
"comment": "헤더",
"type": "basic",
"name": "Div",
"props": {
"className": "text-center mb-8"
},
"children": [
{
"type": "basic",
"name": "Div",
"props": {
"className": "w-16 h-16 mx-auto mb-4 bg-primary-100 dark:bg-primary-900/30 rounded-full flex items-center justify-center"
},
"children": [
{
"type": "basic",
"name": "Icon",
"props": {
"name": "lock",
"size": "xl",
"className": "text-primary-600 dark:text-primary-400"
}
}
]
},
{
"type": "basic",
"name": "H1",
"props": {
"className": "text-2xl font-bold text-gray-900 dark:text-white mb-2"
},
"text": "$t:mypage.profile.change_password_title"
},
{
"type": "basic",
"name": "P",
"props": {
"className": "text-gray-600 dark:text-gray-400"
},
"text": "$t:mypage.profile.change_password_subtitle"
}
]
},
{
"comment": "성공 메시지",
"type": "basic",
"name": "Div",
"props": {
"className": "text-center"
},
"if": "{{_local?.success}}",
"children": [
{
"type": "basic",
"name": "Div",
"props": {
"className": "w-16 h-16 mx-auto mb-4 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center"
},
"children": [
{
"type": "basic",
"name": "Icon",
"props": {
"name": "check",
"size": "xl",
"className": "text-green-600 dark:text-green-400"
}
}
]
},
{
"type": "basic",
"name": "P",
"props": {
"className": "text-green-700 dark:text-green-300 mb-6"
},
"text": "$t:mypage.profile.change_password_success"
},
{
"type": "basic",
"name": "Button",
"props": {
"className": "inline-block px-6 py-3 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors cursor-pointer"
},
"actions": [
{
"type": "click",
"handler": "navigate",
"params": {
"path": "/mypage/profile"
}
}
],
"text": "$t:mypage.profile.back_to_profile"
}
]
},
{
"comment": "폼",
"type": "basic",
"name": "Form",
"dataKey": "form",
"props": {
"className": "space-y-6",
"id": "form"
},
"if": "{{!_local?.success}}",
"actions": [
{
"type": "submit",
"handler": "sequence",
"actions": [
{
"handler": "setState",
"params": {
"target": "local",
"isSubmitting": true
}
},
{
"handler": "apiCall",
"auth_required": true,
"target": "/api/me/password",
"params": {
"method": "PUT",
"body": {
"current_password": "{{form?.current_password}}",
"password": "{{form?.password}}",
"password_confirmation": "{{form?.password_confirmation}}"
}
},
"onSuccess": {
"handler": "setState",
"params": {
"target": "local",
"isSubmitting": false,
"success": true
}
},
"onError": [
{
"handler": "setState",
"params": {
"target": "local",
"isSubmitting": false
}
},
{
"handler": "toast",
"params": {
"type": "error",
"message": "{{response.message ?? '$t:mypage.profile.change_password_failed'}}"
}
}
]
}
]
}
],
"children": [
{
"comment": "현재 비밀번호",
"type": "basic",
"name": "Div",
"children": [
{
"type": "basic",
"name": "Label",
"props": {
"className": "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"
},
"text": "$t:mypage.profile.current_password"
},
{
"type": "basic",
"name": "PasswordInput",
"props": {
"name": "current_password",
"placeholder": "$t:mypage.profile.current_password_placeholder",
"className": "w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed",
"required": true,
"showToggle": true,
"disabled": "{{_local?.isSubmitting ?? false}}"
}
}
]
},
{
"comment": "새 비밀번호",
"type": "basic",
"name": "Div",
"children": [
{
"type": "basic",
"name": "Label",
"props": {
"className": "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"
},
"text": "$t:mypage.profile.new_password"
},
{
"type": "basic",
"name": "PasswordInput",
"props": {
"name": "password",
"placeholder": "$t:mypage.profile.new_password_placeholder",
"className": "w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed",
"required": true,
"showToggle": true,
"showValidation": true,
"enableRules": [
"minLength:8"
],
"disabled": "{{_local?.isSubmitting ?? false}}"
}
}
]
},
{
"comment": "새 비밀번호 확인",
"type": "basic",
"name": "Div",
"children": [
{
"type": "basic",
"name": "Label",
"props": {
"className": "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"
},
"text": "$t:mypage.profile.confirm_password"
},
{
"type": "basic",
"name": "PasswordInput",
"props": {
"name": "password_confirmation",
"placeholder": "$t:mypage.profile.confirm_password_placeholder",
"className": "w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:opacity-50 disabled:cursor-not-allowed",
"required": true,
"showToggle": true,
"isConfirmField": true,
"confirmTarget": "{{_local?.form?.password ?? ''}}",
"disabled": "{{_local?.isSubmitting ?? false}}"
}
}
]
},
{
"comment": "버튼 영역",
"type": "basic",
"name": "Div",
"props": {
"className": "flex flex-col gap-3 pt-2"
},
"children": [
{
"comment": "제출 버튼",
"type": "basic",
"name": "Button",
"props": {
"type": "submit",
"className": "w-full py-3 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors font-medium disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2",
"disabled": "{{_local?.isSubmitting ?? false}}"
},
"children": [
{
"comment": "스피너",
"type": "basic",
"name": "Div",
"if": "{{_local?.isSubmitting}}",
"props": {
"className": "w-5 h-5 border-2 border-white/30 border-t-white rounded-full animate-spin"
}
},
{
"type": "basic",
"name": "Span",
"if": "{{!_local?.isSubmitting}}",
"text": "$t:mypage.profile.change_password_submit"
},
{
"type": "basic",
"name": "Span",
"if": "{{_local?.isSubmitting}}",
"text": "$t:mypage.profile.change_password_processing"
}
]
},
{
"comment": "취소 버튼",
"type": "basic",
"name": "Button",
"props": {
"type": "button",
"className": "w-full py-3 bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors font-medium cursor-pointer",
"disabled": "{{_local?.isSubmitting ?? false}}"
},
"actions": [
{
"type": "click",
"handler": "navigate",
"params": {
"path": "/mypage/profile"
}
}
],
"text": "$t:common.cancel"
}
]
}
]
}
]
}
]
}
]
}
]
}
}