PHP code example of oefenweb / cakephp-uni-login

1. Go to this page and download the library: Download oefenweb/cakephp-uni-login library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oefenweb / cakephp-uni-login example snippets


class UsersController extends AppController {

	public function login_start() {
		$returnUrl = Router::url(['action' => 'login_complete']);
		$url = ['plugin' => 'uni_login', 'controller' => 'uni_login', 'action' => 'login', '?' => ['returnUrl' => $returnUrl]];
		return $this->redirect($url);
	}

	public function login_complete() {
		$secret = Configure::read('UniLogin.application.secret');
		if (!hash_equals($secret, $this->request->data('secret'))) {
			throw new ForbiddenException();
		}

		if ($this->request->data('validated') === true) {
			$key = $this->request->data('user');

			// Find application user by key and login user
		}
	}

}