Пример #1
0
 public function test_belong_to_user()
 {
     $t = Ticket::from(array('token' => self::$model->generate_token(), 'uid' => 1, 'expire_at' => '+1 hour', 'ip' => '::1'));
     $user = $t->user;
     $this->assertInstanceOf('Icybee\\Modules\\Users\\User', $user);
     $this->assertEquals('*****@*****.**', $user->email);
 }
 /**
  * Creates a nonce login ticket.
  *
  * If a previous ticket for the user exists it will be deleted.
  */
 protected function process()
 {
     global $core;
     $user = $this->record;
     $model = $this->module->model;
     # delete previous ticket (if any)
     $model->filter_by_uid($user->uid)->delete();
     # create new ticket
     $ticket = Ticket::from(array('uid' => $user->uid, 'token' => $model->generate_token(), 'expire_at' => '+' . Module::FRESH_PERIOD . ' seconds', 'ip' => $this->request->ip));
     $ticket->save();
     $this->ticket = $ticket;
     $this->response->message = new FormattedString('success', array('%email' => $user->email), array('scope' => \ICanBoogie\normalize($user->constructor, '_') . '.nonce_login_request.operation'));
     return true;
 }