parameters: (self, identifier, name, email, profile_pic_url)
return_statement: return user_id
docstring: Authenticates against JANRAIN, formerly RPX, an authentication
          provider, see http://janrain.com/ for more information
docstring_summary: Authenticates against JANRAIN, formerly RPX, an authentication
          provider, see http://janrain.com/ for more information
docstring_tokens: Authenticates against JANRAIN formerly RPX an authentication provider see http : // janrain . com / for more information
function: def authenticate_janrain(self, identifier, name, email, profile_pic_url):
          """ Authenticates against JANRAIN, formerly RPX, an authentication
          provider, see http://janrain.com/ for more information
  
  
          """
          # Note: If this method is called, it means that the user
          # has been authenticated by the external source (janrain)
          # So all is left to be done is to add the user to our user DB
          # if he/she does not exist, and (*or*, if the user does indeed already
          # exist) update the user's metadata...
          # (name, email)
          # In addition, I am not (currently doing anything with profile_pic_url
          # or identifier but they might come in handy later.
          self.logout()  # Clear up previous session if any
          user = self.db(
              (self.db.auth_users.auth_email == email) &
              (self.db.auth_users.is_enabled == True)).select().first()
          if user is None:
              # User does not exist, create it
              # This password is fake, not used for anything really...
              hash_passwd = hashlib.sha1('%s%s' % (name, identifier)).hexdigest()
              # New User - add it with the default role of Member
              # NOTE: THIS ROLE MUST EXIST
              auth_role_id = self.db(
                  self.db.auth_roles.auth_role_name == 'zMember').select(
                      self.db.auth_roles.id)[0].id
              auth_user_id = self.db.auth_users.insert(
                  auth_email=email,
                  auth_passwd=hash_passwd,
                  auth_created_on=self.request.now,
                  auth_modified_on=self.request.now,
                  is_enabled=True)
  
              # Also, add this user's default role to the corresponding table.
              self.db.auth_user_role.insert(auth_user_id=auth_user_id,
                                            auth_role_id=auth_role_id)
              # Read the (new) user's back
              user = self.db(
                  (self.db.auth_users.auth_email == email) &
                  (self.db.auth_users.is_enabled == True)).select().first()
          user_id = user.id  # Convenience
          self.__user_id = user_id
          self.session.auth_email = email
          self.session.user_id = user_id
          return user_id
function_tokens: def authenticate_janrain ( self , identifier , name , email , profile_pic_url ) : # Note: If this method is called, it means that the user # has been authenticated by the external source (janrain) # So all is left to be done is to add the user to our user DB # if he/she does not exist, and (*or*, if the user does indeed already # exist) update the user's metadata... # (name, email) # In addition, I am not (currently doing anything with profile_pic_url # or identifier but they might come in handy later. self . logout ( ) # Clear up previous session if any user = self . db ( ( self . db . auth_users . auth_email == email ) & ( self . db . auth_users . is_enabled == True ) ) . select ( ) . first ( ) if user is None : # User does not exist, create it # This password is fake, not used for anything really... hash_passwd = hashlib . sha1 ( '%s%s' % ( name , identifier ) ) . hexdigest ( ) # New User - add it with the default role of Member # NOTE: THIS ROLE MUST EXIST auth_role_id = self . db ( self . db . auth_roles . auth_role_name == 'zMember' ) . select ( self . db . auth_roles . id ) [ 0 ] . id auth_user_id = self . db . auth_users . insert ( auth_email = email , auth_passwd = hash_passwd , auth_created_on = self . request . now , auth_modified_on = self . request . now , is_enabled = True ) # Also, add this user's default role to the corresponding table. self . db . auth_user_role . insert ( auth_user_id = auth_user_id , auth_role_id = auth_role_id ) # Read the (new) user's back user = self . db ( ( self . db . auth_users . auth_email == email ) & ( self . db . auth_users . is_enabled == True ) ) . select ( ) . first ( ) user_id = user . id # Convenience self . __user_id = user_id self . session . auth_email = email self . session . user_id = user_id return user_id