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
- Host: GitHub
- URL: https://github.com/ghostffcode/passwordless_login
- Owner: ghostffcode
- Created: 2016-05-02T17:04:03.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-05-04T20:56:50.000Z (about 10 years ago)
- Last Synced: 2025-04-22T10:38:34.992Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 24.4 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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');
```