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


PHP Csrf::isTokenValid方法代码示例

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


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

示例1: login

 /**
  * The login action, when you do login/login
  */
 public function login()
 {
     // check if csrf token is valid
     if (!Csrf::isTokenValid()) {
         LoginModel::logout();
         Redirect::home();
         exit;
     }
     // perform the login method, put result (true or false) into $login_successful
     $login_successful = LoginModel::login(Request::post('user_name'), Request::post('user_password'), Request::post('set_remember_me_cookie'));
     // check login status: if true, then redirect user to user/index, if false, then to login form again
     if ($login_successful) {
         if (Request::post('redirect')) {
             Redirect::toPreviousViewedPageAfterLogin(ltrim(urldecode(Request::post('redirect')), '/'));
         } else {
             Redirect::to('user/index');
         }
     } else {
         if (Request::post('redirect')) {
             Redirect::to('login?redirect=' . ltrim(urlencode(Request::post('redirect')), '/'));
         } else {
             Redirect::to('login/index');
         }
     }
 }
开发者ID:panique,项目名称:huge,代码行数:28,代码来源:LoginController.php

示例2: editUsername_action

 /**
  * Edit user name (perform the real action after form has been submitted)
  */
 public function editUsername_action()
 {
     // check if csrf token is valid
     if (!Csrf::isTokenValid()) {
         LoginModel::logout();
         Redirect::home();
         exit;
     }
     UserModel::editUserName(Request::post('user_name'));
     Redirect::to('user/editUsername');
 }
开发者ID:AstroTheCoder,项目名称:huge,代码行数:14,代码来源:UserController.php

示例3: login

 public function login()
 {
     if (!Csrf::isTokenValid()) {
         self::logout();
     }
     $success = LoginModel::login(Request::post('user_name'), Request::post('user_password'), Request::post('set_remember_me_cookie'));
     // check login status: if true, then redirect user login/showProfile, if false, then to login form again
     if ($success) {
         if (Request::post('redirect')) {
             Redirect::to(ltrim(urldecode(Request::post('redirect')), '/'));
         } else {
             Redirect::to('login/showProfile');
         }
     } else {
         Redirect::to('login/index');
     }
 }
开发者ID:scienide00,项目名称:WebDev_ConferenceScheduler,代码行数:17,代码来源:LoginController.php

示例4: ajaxLogin

 public function ajaxLogin()
 {
     if (!Csrf::isTokenValid()) {
         LoginModel::logout();
         echo 'NT';
         return;
     }
     openssl_private_decrypt(base64_decode(Request::get_post('password')), $password, Session::get('RSA_private'));
     $login_successful = LoginModel::login(Request::get_post('username'), $password, Request::get_post('remember_me'));
     if ($login_successful) {
         if ($redirect = Request::get_post('redirect')) {
             echo ltrim(urldecode($redirect), '/');
         } else {
             echo Config::get('URL') . '/account';
         }
     } else {
         echo 'N';
     }
 }
开发者ID:heyjohnnyfunt,项目名称:sendashare,代码行数:19,代码来源:LoginController.php

示例5: editUsername_action

 /**
  * Edit user name (perform the real action after form has been submitted)
  * Auth::checkAuthentication() makes sure that only logged in users can use this action
  */
 public function editUsername_action()
 {
     Auth::checkAuthentication();
     // check if csrf token is valid
     if (!Csrf::isTokenValid()) {
         self::logout();
     }
     UserModel::editUserName(Request::post('user_name'));
     Redirect::to('login/index');
 }
开发者ID:JavierTavera,项目名称:huge,代码行数:14,代码来源:LoginController.php


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