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


PHP Sentry::activate_user方法代码示例

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


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

示例1: action_activate

 /**
  * Activate user account
  * 
  * @param unknown_type $email
  * @param unknown_type $hash
  */
 public function action_activate($email = false, $hash = false)
 {
     $settings = \Config::load('autoresponder.db');
     if ($email && $hash) {
         //Keep existing messages
         \Messages::instance()->shutdown();
         try {
             if ($user = \Sentry::activate_user($email, $hash)) {
                 $email_data = array('site_title' => \Config::get('site_title'), 'customer_name' => ucwords($user->get('metadata.first_name')));
                 // Send email to user
                 $email_sent = \App\Emailer::send_email_to_user($user->email, $email_data['customer_name'], 'Welcome to ' . $settings['website'], '_email/user_register', $email_data);
                 // Send email to admins
                 \App\Emailer::send_email_to_group('register', 'Welcome to ' . $settings['website'], '_email/user_register', $email_data);
                 if ($email_sent) {
                     // \Messages::success('Accout successfully activated. Please login and start using your account.');
                     \Messages::success('Welcome! Your account is now activated. Please log in.');
                 } else {
                     \Messages::error('Error while sending email.');
                 }
             } else {
                 //\Messages::error('<h4>There was an error while trying activate user</h4>');
                 \Messages::error('Wrong activation code. Please check your email and try again.');
             }
         } catch (\Sentry\SentryException $e) {
             // show validation errors
             //\Messages::error('<h4>There was an error while trying activate user</h4>');
             $errors = $e->getMessage();
             \Messages::error($errors);
         }
     }
     \Response::redirect(\Uri::front_create('user/login'));
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:38,代码来源:user.php

示例2: get_activate

 public function get_activate($email = null, $hash = null)
 {
     try {
         $activate_user = Sentry::activate_user($email, $hash);
         if ($activate_user) {
             return Redirect::to('user/login');
         } else {
             echo 'The user was not activated';
         }
     } catch (Sentry\SentryEXception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:imbrj,项目名称:laravel-sentry-tutorial,代码行数:13,代码来源:user.php

示例3: get_activate

 public function get_activate($hash, $key)
 {
     $activate_user = Sentry::activate_user($hash, $key);
     if ($activate_user) {
         try {
             // Force login
             Sentry::force_login($activate_user->email);
             return View::make('user.activation-complete')->with('error', false);
         } catch (Sentry\SentryException $e) {
             return View::make('user.activation-complete')->with('error', true);
         }
     } else {
         return View::make('user.activation-complete')->with('error', true);
     }
 }
开发者ID:CSFix,项目名称:L3-Eticaret,代码行数:15,代码来源:user.php

示例4: action_address

 public function action_address()
 {
     if ($this->check_logged_type() == 'guest') {
         \Sentry::logout();
     }
     if ($this->check_logged()) {
         \Response::redirect(\Uri::create('order/checkout/cost'));
     }
     if (\Input::post('details')) {
         // check for a valid CSRF token
         if (!\Security::check_token()) {
             \Messages::error('CSRF attack or expired CSRF token.');
             \Response::redirect(\Input::referrer(\Uri::create('/')));
         }
         $insert = \Input::post();
         if (!$insert['create_account']) {
             $val = \User\Controller_Validate::forge('guest', false, \Input::post('same_address', 1) ? false : 'shipping');
         } else {
             $val = \User\Controller_Validate::forge('create', false, \Input::post('same_address', 1) ? false : 'shipping');
         }
         if ($val->run()) {
             // Get POST values
             array_walk($insert, create_function('&$val', '$val = trim($val);'));
             try {
                 // Mark user as guest if its that case
                 if (!$insert['create_account']) {
                     $insert['guest'] = 1;
                     $guest = 1;
                     $username = uniqid(time(), true);
                 } else {
                     $username = $insert['email'];
                     $insert['guest'] = 0;
                 }
                 $email = $insert['email'];
                 $password = $insert['password'] ? $insert['password'] : \Str::random('alnum', 10);
                 $user_group = $insert['guest'] ? 3 : 4;
                 unset($insert['details'], $insert['signup'], $insert['user_group'], $insert['username'], $insert['email'], $insert['password'], $insert['confirm_password'], $insert['confirm_email'], $insert['terms'], $insert['create_account'], $insert['same_address'], $insert['fuel_csrf_token']);
                 // create the user - no activation required
                 $vars = array('username' => $username, 'email' => $email, 'password' => $password, 'metadata' => $insert);
                 $user_registration = \Sentry::user()->register($vars);
                 $user = \Sentry::user($user_registration['id']);
                 // Add user to 'customer' group (id = 3)
                 if ($user_registration and $user->add_to_group($user_group)) {
                     // Activate account
                     $activation = explode('/', $user_registration['hash']);
                     \Sentry::activate_user($activation[0], $activation[1]);
                     // Login user and redirect to next page
                     //\Sentry::login($email, $password, true);
                     \Sentry::login($username, $password, true);
                     \Response::redirect(\Uri::front_create('order/checkout/cost'));
                 }
             } catch (\Sentry\SentryException $e) {
                 // show validation errors
                 //\Messages::error('<h4>There was an error while trying to create user</h4>');
                 $errors = $e->getMessage();
                 \Messages::error($errors);
             }
         } else {
             if ($val->error() != array()) {
                 // show validation errors
                 //\Messages::error('<h4>There was an error while trying to create user</h4>');
                 foreach ($val->error() as $e) {
                     \Messages::error($e->get_message());
                 }
             }
         }
     }
     \Theme::instance()->set_partial('content', $this->view_dir . 'address');
 }
开发者ID:EdgeCommerce,项目名称:edgecommerce,代码行数:69,代码来源:checkout+copy.php

示例5: function

 }
 /**
  * Activate a new user and log them in
  * @todo Finish email authentication mechanism
  */
 if (FALSE && Config::get('xysti.routes.auth.activate')) {
     Route::get('activate/(:any)/(:any)', function () {
         Xysti::helper('dbug');
         $auth_driver = Config::get('xysti.auth', 'default');
         // Default auth
         if ($auth_driver == 'default') {
             Xysti::error(500, 'Default auth currently not configured for activation.');
             // Sentry auth
         } elseif ($auth_driver == 'sentry') {
             try {
                 $activate_user = Sentry::activate_user(URI::segment(2), URI::segment(3), FALSE);
             } catch (Sentry\SentryException $e) {
                 // issue activating the user
                 // store/set and display caught exceptions such as a suspended user with limit attempts feature.
                 $errors = $e->getMessage();
             }
         } else {
             return Xysti::error(500, 'Unknown authentication driver.');
         }
         if ($activate_user) {
             //Sentry::force_login(URI::segment(2));
             return Redirect::to(Xysti::page('login', 'post_login'));
         } else {
             return Xysti::make(500, 'User activation failed.');
         }
     });
开发者ID:SerdarSanri,项目名称:Xysti,代码行数:31,代码来源:routes.php


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