An open API service indexing awesome lists of open source software.

https://github.com/ghostffcode/passwordless_login

:pizza: Login without password in PHP
https://github.com/ghostffcode/passwordless_login

Last synced: about 1 year ago
JSON representation

:pizza: Login without password in PHP

Awesome Lists containing this project

README

          

# passwordless Login
Simple php passwordless login system

## How to use

### Send code to email and create session
```php
sendCode('trial@example.com'); // pass email as argument to sendCode() method
?>
```

### Verify code that user enters
```php
$code = 23456;
$trial = 5;
// Add user code to validate() method
// Takes two arguments
// First is code from the user email
// Second argument (optional) is number of login trials. Default is 3 trials
$p->validate($code [, $trial]); //will log user in if successful
```

### Check if user is logged in
You have to use this in every page that user must be logged in to view
```php
// returns true if user is logged in and false if not logged in
$p->loggedIn();
```

### To log out and destroy session
```php
// This will log user out and redirect to homepage (index.php)
// You can pass in redirect location as argument
// Use this to logout and redirect to index.php
$p->logOut();

// Use this to logout and redirect to nice.php
$p->logOut('nice.php');
```