function handle($channel)
 {
     $disabled = common_config('logincommand', 'disabled');
     $disabled = isset($disabled) && $disabled;
     if ($disabled) {
         $channel->error($this->user, _('Login command is disabled'));
         return;
     }
     try {
         $login_token = Login_token::makeNew($this->user);
     } catch (Exception $e) {
         $channel->error($this->user, $e->getMessage());
     }
     $channel->output($this->user, sprintf(_('This link is useable only once, and is good for only 2 minutes: %s'), common_local_url('otp', array('user_id' => $login_token->user_id, 'token' => $login_token->token))));
 }
 static function login($email, $password)
 {
     $domain = self::toDomain($email);
     $sn = self::siteForDomain($domain);
     if (empty($sn)) {
         throw new ClientException(_("No such site."));
     }
     StatusNet::switchSite($sn->nickname);
     $user = common_check_user($email, $password);
     if (empty($user)) {
         // TRANS: Form validation error displayed when trying to log in with incorrect credentials.
         throw new ClientException(_('Incorrect username or password.'));
     }
     $loginToken = Login_token::makeNew($user);
     if (empty($loginToken)) {
         throw new ServerException(sprintf(_('Could not create new login token for user %s'), $user->nickname));
     }
     $url = common_local_url('otp', array('user_id' => $loginToken->user_id, 'token' => $loginToken->token));
     if (empty($url)) {
         throw new ServerException(sprintf(_('Could not create new OTP URL for user %s'), $user->nickname));
     }
     return $url;
 }