2012-11-29 38 views
5

Tôi cần mật khẩu cho máy chủ sftp làm trường cấu hình cho mô-đun Magento mà tôi đang làm việc. Thêm trường là đủ đơn giản, nhưng Magento không thực sự mã hóa giá trị chỉ vì nó có một số frontend_type của password.Tùy chỉnh mã cấu hình quản trị viên Magento tùy chỉnh

<sftp_password translate="label"> 
    <label>SFTP Password</label> 
    <frontend_type>password</frontend_type> 
    <sort_order>170</sort_order> 
    <show_in_default>1</show_in_default> 
    <show_in_website>1</show_in_website> 
    <show_in_store>1</show_in_store> 
</sftp_password> 

Tôi chưa thể tìm thấy tài liệu về cách mã hóa đúng giá trị này. Làm cách nào để đảm bảo mật khẩu được mã hóa khi được lưu trữ trong cơ sở dữ liệu?

Trả lời

11
<sftp_password translate="label"> 
     <label>SFTP Password</label> 
     <frontend_type>obscure</frontend_type> 
     <backend_model>adminhtml/system_config_backend_encrypted</backend_model> 
     <sort_order>10</sort_order> 
     <show_in_default>1</show_in_default> 
     <show_in_website>1</show_in_website> 
     <show_in_store>0</show_in_store> 
</sftp_password> 

// assuming that getConfigData return Mage::getStoreConfig($path, $storeId); 
$this->getConfigData('sftp_password'); 

frontend_type: Mật khẩu vs Obscure

che khuất kéo dài mật khẩu, nhưng vì lý do an ninh nó thay thế theo chiều dài của số mật khẩu thực tế của '*'s với 6 '*'s vì vậy bạn không thể nói chiều dài của mật khẩu

Xem/lib/Varien/Data/Form/Yếu tố/

Read more @XML for Admin Configurations

+0

Tò mò, ' mật khẩu' có vẻ giống như 'tối nghĩa'. Có sự khác biệt nào hay không được chấp nhận? – kojiro

+2

Làm mờ mật khẩu mở rộng .. xem bài đăng cập nhật của tôi để biết thêm thông tin –

Các vấn đề liên quan