Get wordpress stored cookies for custom login

I've created a custom login box. I'm using wp_signon() method. Everything works well.Also i have a Remember me

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
 |  Show 2 more comments

1 Answer 1

Reset to default 4

if 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

相关推荐

  • Get wordpress stored cookies for custom login

    I've created a custom login box. I'm using wp_signon() method. Everything works well.Also i have a Remember me

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信