admin管理员组文章数量:1415137
I'm trying to add a password form to the WP registration form. See the code below. I was wondering if I need to sanitize this specific user input? (and if so how?)
If I understand it correctly, WP has sanitizion built in for some things, and passwords may be one of them. Is that correct? Will WP sanitize it automatically before adding it to the database?
add_action( 'register_new_user', 'registration_change_pass', 10, 99 );
function registration_change_pass( $user_id ) {
if ( isset( $_POST['user_password'] ) ) {
wp_set_password( $_POST['user_password'], $user_id ); }
}
I'm trying to add a password form to the WP registration form. See the code below. I was wondering if I need to sanitize this specific user input? (and if so how?)
If I understand it correctly, WP has sanitizion built in for some things, and passwords may be one of them. Is that correct? Will WP sanitize it automatically before adding it to the database?
add_action( 'register_new_user', 'registration_change_pass', 10, 99 );
function registration_change_pass( $user_id ) {
if ( isset( $_POST['user_password'] ) ) {
wp_set_password( $_POST['user_password'], $user_id ); }
}
Share
Improve this question
edited Aug 26, 2019 at 3:28
Jacob Peattie
44.2k10 gold badges50 silver badges64 bronze badges
asked Aug 25, 2019 at 17:56
J. StocklandJ. Stockland
1156 bronze badges
1 Answer
Reset to default 2No, there is no need to sanitize passwords. You don't want to strip out or rewrite a value on users' set passwords. They will be hashed afterwards, so no need
本文标签: phpIs it necessary to sanitize wpsetpassword user input
版权声明:本文标题:php - Is it necessary to sanitize wp_set_password user input? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745214965a2648109.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论