How to auto redirect user having Auto-Login cookie, using Auto-Login component in CakePHP 2x?
By : ranjani
Date : March 29 2020, 07:55 AM
Hope that helps I am using CakePHP 2x with Auto-Login component. The problem is, I can write the stuff but, I am not sure how to implement it to read and authorize. When user arrives at the page, he still has the cookie in his browser but, how do I authorize it? , This should be something like: code :
public function login()
{
if ($this->request->is('post'))
{
if ($this->Auth->login())
{
if ($this->request->data['User']['persist'] == '1')
{
$cookie = array();
$cookie['username'] = $this->data['User']['USER_LOGINNAME'];
$cookie['password'] = $this->data['User']['USER_PASSWORD'];
$this->Cookie->write('Auth.User', $cookie, true, '+4 weeks');
}
$this->redirect($this->Auth->redirect());
}
else
{
$this->Session->setFlash('Your username or password was incorrect.', 'default/flash-error');
}
}
else
{
$user = $this->Auth->user();
if (empty($user))
{
$cookie = $this->Cookie->read('Auth.User');
if (!is_null($cookie))
{
$user = $this->User->find('first', array('conditions' => array('USER_LOGINNAME' => $cookie['username'], 'USER_PASSWORD' => AuthComponent::password($cookie['password']))));
if ($this->Auth->login($user['User']))
{
$this->Session->delete('Message.auth');
$this->redirect($this->Auth->redirect());
}
else
{
$this->Cookie->delete('Auth.User');
}
}
}
else
{
$this->redirect($this->Auth->redirect());
}
}
}
|
Auto generate password and set security Q & A option for first time login
By : Amrapali Kamble
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You have to keep track of that in your database. You can have bit type field in the database for example IsFirstTimeLogin and set it true for the first usage and after successful login set it to false. You can also setup a field to specify if the user required to change password. If that field is set to true then you can ask the user to change the password. You can use the required password change field for period changes to the password in future as well. As far as auto generating the password in concerned you can use the email id as the first password, but if you want some more secure option then you can issue any randomly generated password to the user, or you can use GetHashCode for password generations. Something like: code :
string email = "test@test.com";
string password = Math.Abs(email.GetHashCode()).ToString();
|
Windows 8 auto start a program before user login
By : Fat Joe
Date : March 29 2020, 07:55 AM
this will help I found this for windows 7 & maybe it'll work with Windows 8 too. If you want it to start before the user logs on, you will have to start it as a service.
|
Auto-Start Program at Login in Angstrom on BeagleBoard
By : GMH
Date : March 29 2020, 07:55 AM
this will help Found the answer: The script /etc/profile is ran when the user logs in. You can add a line to start your application at the end it.
|
Any way to generate a Auto Login/Token Authentication Link?
By : Richard Martínez
Date : March 29 2020, 07:55 AM
this will help You could definitely do this by using something like a JSON Web Token (JWT). Basically, the way it works is like this:
|