checks if there is SocialFrind model record for the user
        if not attempt to create one
        if all fail, redirects to the next page
557614
def get_context_data(self, **kwargs):
        
        context = super(FriendListView, self).get_context_data(**kwargs)

        friends = []
        for friend_list in self.social_friend_lists:
            fs = friend_list.existing_social_friends()
            for f in fs:
                friends.append(f)

        # Add friends to context
        context['friends'] = friends

        connected_providers = []
        for sa in self.social_auths:
            connected_providers.append(sa.provider)
        context['connected_providers'] = connected_providers

        return context
717417
def next_page
      raise Ork::NoNextPage.new 'There is no next page' unless has_next_page?

      self.class.new(@model,
                     @index,
                     @query,
                     @options.merge(continuation: keys.continuation))
    end
469482
public function actionIndex()
    {
        if (($model = Authentication::findOne(['user_id' => Yii::$app->user->id])) == null) {
            return $this->redirect(['create']);
        }
        return $this->render('index', [
            'model' => $model
        ]);
    }
979964
def attempt_social_login(self, provider, id):
        
        if not provider or not id:
            return False

        params = dict()
        params[provider.lower() + '_id'] = id
        user = self.first(**params)
        if not user:
            return False

        self.force_login(user)
        return True
660382
def check_page_availability!(type)
      return unless @attributes[type.to_sym].nil?

      raise(
        type.eql?(:next) ?
          UserEngage::NoNextPageAvailableException :
          UserEngage::NoPreviousPageAvailableException,
        "No #{type} page available"
      )
    end
1369817
private void checkForNewShard(DBObject dbObj) {
        int shardNumber = m_tableDef.getShardNumber(dbObj);
        if (shardNumber > 0) {
            SpiderService.instance().verifyShard(m_tableDef, shardNumber);
        }
    }
739838
public function index()
    {
        //  If already logged out just send them silently on their way
        if (!isLoggedIn()) {
            redirect('/');
        }

        // --------------------------------------------------------------------------

        //  Generate an event for this log in
        create_event('did_log_out');

        // --------------------------------------------------------------------------

        //  Log social media out
        $oSocial = Factory::service('SocialSignOn', 'nails/module-auth');
        $oSocial->logout();

        // --------------------------------------------------------------------------

        //  Log user out
        $oAuthModel = Factory::model('Auth', 'nails/module-auth');
        $oAuthModel->logout();

        // --------------------------------------------------------------------------

        redirect();
    }
150880
def existing_social_friends(self, user_social_auth=None, friend_ids=None):
        
        # Type check
        self.assert_user_is_social_auth_user(user_social_auth)

        if not friend_ids:
            friend_ids = self.fetch_social_friend_ids(user_social_auth)

        # Convert comma sepearated string to the list
        if isinstance(friend_ids, basestring):
            friend_ids = eval(friend_ids)

        # Match them with the ones on the website
        if USING_ALLAUTH:
            return User.objects.filter(socialaccount__uid__in=friend_ids).all()            
        else:
            return User.objects.filter(social_auth__uid__in=friend_ids).all()
48876
def POST(self, *args, **kwargs):
        
        if self.user_manager.session_logged_in():
            if not self.user_manager.session_username() and not self.__class__.__name__ == "ProfilePage":
                raise web.seeother("/preferences/profile")

            if not self.is_lti_page and self.user_manager.session_lti_info() is not None:  # lti session
                self.user_manager.disconnect_user()
                return self.template_helper.get_renderer().auth(self.user_manager.get_auth_methods_fields(), False)

            return self.POST_AUTH(*args, **kwargs)
        else:
            user_input = web.input()
            if "login" in user_input and "password" in user_input:
                if self.user_manager.auth_user(user_input["login"].strip(), user_input["password"]) is not None:
                    return self.GET_AUTH(*args, **kwargs)
                else:
                    return self.template_helper.get_renderer().auth(self.user_manager.get_auth_methods(), True)
            else:
                return self.template_helper.get_renderer().auth(self.user_manager.get_auth_methods(), False)
1233381
def page_exists?(page)
      return false if page.user_data && page.user_data.p_seeded
      @storage.exists?(page) && !page_expired?(page)
    end
292852
def index
      @return_url = params[:return_url].nil? ? "/" : params[:return_url];
      @modal = params[:modal].nil? ? false : params[:modal]
      redirect_to @return_url and return if logged_in?
      @page.title = "Create an Account" if @page
      render :layout => "caboose/application"
    end
554694
def invited_by?(user)
      user.friend_ids.include?(self.id) or user.pending_friend_ids.include?(self.id)
    end
1118996
def _link(self, *args, **kwargs):
        
        if self._record.redirect_url:
            return links.resolve(self._record.redirect_url,
                                 self.search_path, kwargs.get('absolute'))

        return self._permalink(*args, **kwargs)
91416
def _get_next_all_link_record(self):
        """"""
        _LOGGER.debug("Starting: _get_next_all_link_record")
        _LOGGER.debug("Requesting Next All-Link Record")
        msg = GetNextAllLinkRecord()
        self.send_msg(msg, wait_nak=True, wait_timeout=.5)
        _LOGGER.debug("Ending: _get_next_all_link_record")
600478
def joinOn(self, model, onIndex):
        
        return self._joinOnAsPriv(model, onIndex, model.__name__)
216270
def post(self, *args, **kwargs):
        
        # Look for a wizard_prev_step element in the posted data which
        # contains a valid step name. If one was found, render the requested
        # form. (This makes stepping back a lot easier).
        wizard_prev_step = self.request.POST.get('wizard_prev_step', None)
        if wizard_prev_step and wizard_prev_step in self.get_form_list():
            self.storage.current_step = wizard_prev_step
            form = self.get_form(
                data=self.storage.get_step_data(self.steps.current),
                files=self.storage.get_step_files(self.steps.current))
            return self.render(form)

        # Check if form was refreshed
        management_form = ManagementForm(self.request.POST, prefix=self.prefix)
        if not management_form.is_valid():
            raise ValidationError(
                'ManagementForm data is missing or has been tampered.')

        form_current_step = management_form.cleaned_data['current_step']
        if (form_current_step != self.steps.current and
                self.storage.current_step is not None):
            # form refreshed, change current step
            self.storage.current_step = form_current_step

        # get the form for the current step
        form = self.get_form(data=self.request.POST, files=self.request.FILES)

        # and try to validate
        if form.is_valid():
            # if the form is valid, store the cleaned data and files.
            self.storage.set_step_data(self.steps.current, self.process_step(form))
            self.storage.set_step_files(self.steps.current, self.process_step_files(form))

            # check if the current step is the last step
            if self.steps.current == self.steps.last:
                # no more steps, render done view
                return self.render_done(form, **kwargs)
            else:
                # proceed to the next step
                return self.render_next_step(form)
        return self.render(form)
538614
def status
      return if !verify_logged_in

      resp = Caboose::StdClass.new
      resp.saved = SavedProperty.where(:user_id => logged_in_user.id, :mls => params[:mls]).exists?
      render :json => resp
    end