I've created a custom login box. I'm using wp_signon()
method. Everything works well.
Also i have a Remember me checkbox so i can remember user credentials next time. I know i can do it my own way of handling cookies but i want know is there any wordpress builtin method to get cookies.
This is my code so far:
$creds['user_login'] = $user_login;
$creds['user_password'] = $user_pass;
$creds['remember'] = ($remember_me === "true") ? true : false;
$user = wp_signon( $creds, false );
I can see auth
cookies on Firebug Cookies tab but they are appended with hashes. How can i decrypt them or any safer method to get cookies. I've also seen in utils.js
and there are some methods to get and set cookies but it only gets plain text cookies. (Correct me if iam wrong).
Simply i want the data that Wordpress has stored in the cookies when logged in. After logout and return to my login box it can fill my login box with username and password (Like wordpress default login page).
I've created a custom login box. I'm using wp_signon()
method. Everything works well.
Also i have a Remember me checkbox so i can remember user credentials next time. I know i can do it my own way of handling cookies but i want know is there any wordpress builtin method to get cookies.
This is my code so far:
$creds['user_login'] = $user_login;
$creds['user_password'] = $user_pass;
$creds['remember'] = ($remember_me === "true") ? true : false;
$user = wp_signon( $creds, false );
I can see auth
cookies on Firebug Cookies tab but they are appended with hashes. How can i decrypt them or any safer method to get cookies. I've also seen in utils.js
and there are some methods to get and set cookies but it only gets plain text cookies. (Correct me if iam wrong).
Simply i want the data that Wordpress has stored in the cookies when logged in. After logout and return to my login box it can fill my login box with username and password (Like wordpress default login page).
Share Improve this question edited Jan 4, 2014 at 15:42 Rahil Wazir asked Jan 4, 2014 at 9:10 Rahil WazirRahil Wazir 1,03116 silver badges26 bronze badges 7- It isn't clear what you are trying to do. WordPress will "remember" a user by means of a time limited cookie. How is that different from what you want to do? Honestly, it sounds a bit like you are trying to subvert WordPress login security by saving plain text passwords. – s_ha_dum Commented Jan 4, 2014 at 15:18
- @s_ha_dum Simply i want the data that Wordpress has stored in the cookies when logged in. After logout and return to my login box it can fill my login box with username and password (Like wordpress default login page). – Rahil Wazir Commented Jan 4, 2014 at 15:22
- So you do want to save the plain text password? Don't do that. How does the site know when your return vs. when someone else returns? If you aren't logged in how do you distinguish users? And how is this better than just setting a very long expiration on the existing login cookie? – s_ha_dum Commented Jan 4, 2014 at 15:27
- No @s_ha_dum you're not getting it. When checked remember me and logged in, Wordpress store secure cookies and i want that cookies for my login page so i don't have to type username password again. Actually those cookies are secure so it changes everytime. – Rahil Wazir Commented Jan 4, 2014 at 15:31
- I can't really "try it myself" you haven't posted working code, just a small snippet. – s_ha_dum Commented Jan 4, 2014 at 15:43
1 Answer
Reset to default 4if you are logged in wp_parse_auth_cookie(LOGGED_IN_COOKIE);
will return array consisting wp user name, cookie hash and expiration time. This function will return null if you are not logged in. But you cannot get plain password as wordpress doesn't store plain password.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745137456a4613271.html
评论列表(0条)