当前位置: 首页>>代码示例>>PHP>>正文


PHP Authentication::authenticate方法代码示例

本文整理汇总了PHP中Authentication::authenticate方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::authenticate方法的具体用法?PHP Authentication::authenticate怎么用?PHP Authentication::authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Authentication的用法示例。


在下文中一共展示了Authentication::authenticate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _run

 protected function _run($request)
 {
     if ($this->requestMethod == 'POST' && count($request) == 0) {
         // User tries to login
         Authentication::login($_POST['username'], $_POST['password']);
         if (!Authentication::authenticated()) {
             Headers::sendStatusUnauthorized();
             return;
         } else {
             Headers::sendStatusOk();
             echo "login succeeded<br>";
             return;
         }
     } else {
         Authentication::authenticate();
         if (!Authentication::authenticated()) {
             Headers::sendStatusUnauthorized();
             return;
         }
         if ($this->requestMethod == 'GET' && count($request) > 0) {
             // User info requested
             echo "requesting userinfo of user " . $request[0];
         } else {
             // Bad request
             Headers::sendStatusMethodNotAllowed();
             echo "Method not allowed<br>";
             print_r($request);
         }
     }
 }
开发者ID:tuksik,项目名称:zarafa-rest-api,代码行数:30,代码来源:class.UsersResourceController.php

示例2: __construct

 public function __construct($request)
 {
     $this->_setRequestMethod();
     Authentication::authenticate();
     if (!Authentication::authenticated()) {
         // Return unauthorised response
         Headers::sendStatusUnauthorised();
         echo "Unauthorised<br>";
         return;
     }
     $this->_run($request);
 }
开发者ID:tuksik,项目名称:zarafa-rest-api,代码行数:12,代码来源:class.ResourceController.php

示例3: authenticate

 protected function authenticate()
 {
     $auth = new Authentication();
     if (($user = $auth->authenticate($_POST['Login']['Username'], hash('sha512', $_POST['Login']['Password']))) !== false) {
         if (!isset($_SESSION['Authenticated'])) {
             $_SESSION['Authentication'] = array();
         }
         $_SESSION['Authentication']['User'] = $user;
         $_SESSION['Authentication']['LoggedIn'] = true;
     } else {
         $GLOBALS['Smarty']->assign('errormessage', 'Login fehlgeschlagen');
     }
 }
开发者ID:OdysseyDE,项目名称:omer_team_registration,代码行数:13,代码来源:AuthenticatedCommand.php

示例4: loginSubmit

 public function loginSubmit($credentials = [])
 {
     if (isset($credentials)) {
         if ($credentials['userid'] != '') {
             if ($credentials['password'] != '') {
                 if (Authentication::authenticate($credentials)) {
                     $_SESSION['userid'] = $credentials['userid'];
                     $_SESSION['isLogin'] = true;
                     header("Location: ../welcome/");
                 } else {
                     $this->flushOutput('Login failed.');
                 }
             } else {
                 $this->flushOutput('Please fill Password.');
             }
         } else {
             $this->flushOutput('Please fill ID No.');
         }
     }
 }
开发者ID:vincentnacar02,项目名称:beans-php,代码行数:20,代码来源:LoginController.php

示例5: dirname

 *
 * The second part of the query is provided by AJAX in the form of the -query- variable, containing
 * whatever terms the user enters in the autocomplete field.
 */
/**
 * allow for testing
 */
$debug = false;
/**
 * includes
 */
require_once dirname(dirname(dirname(__FILE__))) . "/redcap_connect.php";
/**
 * restricted use
 */
$userAuthenticated = Authentication::authenticate();
if ($userAuthenticated) {
    /**
     * get text entered by user. This is appended to query string by jquery autocomplete
     */
    $full_query = $_GET['q'];
    $term = prep($_GET['term']);
    /**
     * get field name, used to make session unique
     */
    $field_name = $_GET['f'];
    $query_field = $_GET['a'];
    /**
     * get query fragment, passed in session variable to keep prying eyes away
     * results should be limited by adding LIMIT 0,n to query after $term enclosure
     * if no session variable, return an appropriate error value
开发者ID:hcv-target,项目名称:redcap_plugins,代码行数:31,代码来源:autocomplete_control_ajax.php


注:本文中的Authentication::authenticate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。