Exemplo n.º 1
0
 def authenticateUser(self, authGuid):
     # kill existing session
     # self.session.kill()
     
     userId, redirectLink = mUser.createUserFromAuthGuid(self.db, authGuid)
     isSuccess = False
     
     if (userId):
         isSuccess = True
         user = mUser.User(self.db, userId)
     
         # log in user
         self.session.user_id = userId
         self.session.invalidate()
         # set cbu_key for blog access
         web.setcookie('cbu_key', util.obfuscate(userId), domain = ".changeby.us")
         
         mIdea.attachIdeasByEmail(self.db, user.email)
         
         if (user.phone and len(user.phone) > 0):
             mIdea.attachIdeasByPhone(self.db, user.phone)            
 
     return self.render('join', { 'is_email_auth_attempt':True, 
                                  'is_email_auth_attempt_successful': isSuccess,
                                  'post_auth_redirect_link': redirectLink })
Exemplo n.º 2
0
    def authenticateUser(self, authGuid):
        # kill existing session
        # self.session.kill()

        userId = mUser.createUserFromAuthGuid(self.db, authGuid)
        isSuccess = False

        if (userId):
            isSuccess = True
            user = mUser.User(self.db, userId)

            # log in user
            self.session.user_id = userId
            self.session.invalidate()
            # set cbu_key for blog access
            web.setcookie('cbu_key',
                          util.obfuscate(userId),
                          domain=".changeby.us")

            mIdea.attachIdeasByEmail(self.db, user.email)

            if (user.phone and len(user.phone) > 0):
                mIdea.attachIdeasByPhone(self.db, user.phone)

        return self.render(
            'join', {
                'is_email_auth_attempt': True,
                'is_email_auth_attempt_successful': isSuccess
            })
Exemplo n.º 3
0
    def newUser(self):
        firstName = self.request('f_name')
        lastName = self.request('l_name')
        email = self.request('email')
        password = self.request('password')
        phone = util.cleanUSPhone(self.request('sms_phone'))
        code = self.request('beta_code')

        if (self.appMode == 'beta' and not self.verifyBetaCode(code)):
            log.error("*** beta user attempted register w/ invalid code")
            return False
        elif (len(firstName) == 0):
            log.error("*** error on user create: no first name")
            return False
        elif (len(lastName) == 0):
            log.error("*** error on user create: no last name")
            return False
        elif (len(email) == 0 or not util.validate_email(email)):
            log.error("*** error on user create: invalid email")
            return False
        elif (len(password) == 0):
            log.error("*** error on user create: no password")
            return False
        else:
            userId = mUser.createUser(self.db, email, password, firstName,
                                      lastName, phone)

            if (userId):
                # log in user
                self.session.user_id = userId
                self.session.invalidate()
                # set cbu_key for blog access
                web.setcookie('cbu_key',
                              util.obfuscate(userId),
                              domain=".changeby.us")

                if (self.appMode == 'beta'):
                    self.expireBetaCode(code, userId)

                mIdea.attachIdeasByEmail(self.db, email)

                if (phone and len(phone) > 0):
                    mIdea.attachIdeasByPhone(self.db, phone)

                return userId
            else:
                return False
Exemplo n.º 4
0
    def newUser(self):
        firstName = self.request('f_name')
        lastName = self.request('l_name')
        email = self.request('email')
        password = self.request('password')
        phone = util.cleanUSPhone(self.request('sms_phone'))
        code = self.request('beta_code')        
                
        if (self.appMode == 'beta' and not self.verifyBetaCode(code)):
            log.error("*** beta user attempted register w/ invalid code")
            return False        
        elif (len(firstName) == 0): 
            log.error("*** error on user create: no first name")
            return False
        elif (len(lastName) == 0): 
            log.error("*** error on user create: no last name")
            return False
        elif (len(email) == 0 or not util.validate_email(email)): 
            log.error("*** error on user create: invalid email")
            return False
        elif (len(password) == 0): 
            log.error("*** error on user create: no password")
            return False
        else:
            userId = mUser.createUser(self.db, email, password, firstName, lastName, phone)
            
            if (userId):
                # log in user
                self.session.user_id = userId
                self.session.invalidate()
                # set cbu_key for blog access
                web.setcookie('cbu_key', util.obfuscate(userId), domain = ".changeby.us")

            
                if (self.appMode == 'beta'):
                    self.expireBetaCode(code, userId)
                
                mIdea.attachIdeasByEmail(self.db, email)
                
                if (phone and len(phone) > 0):
                    mIdea.attachIdeasByPhone(self.db, phone)
            
                return userId
            else:
                return False