Esempio n. 1
0
 def findTemporaryEmailCredential(self, secret):
     cred = Credential.getBySecret("changeemail", secret)
     verify = False
     if cred is None:
         credverify = Credential.getBySecret("changeemailandverify", secret)
         if credverify is None:
             raise ReportedError(badChangeEmailSecret, 403)
         else:
             cred = credverify
             verify = True
     return cred, verify
Esempio n. 2
0
 def findTemporaryEmailCredential(self, secret):
     cred = Credential.getBySecret("changeemail", secret)
     verify = False
     if cred is None:
         credverify = Credential.getBySecret("changeemailandverify", secret)
         if credverify is None:
             raise ReportedError(badChangeEmailSecret, 403)
         else:
             cred = credverify
             verify = True
     return cred, verify
Esempio n. 3
0
 def the_reset_link_is_in_the_reset_email(self):
     self._sendPasswordResetEmail()
     text = self.outbox[0].html
     soup = BeautifulSoup(text, "lxml")
     passwordResetLink = soup.find("a")['href']
     self.secret = passwordResetLink.split('secret=')[1]
     self.tempcred = Credential.getBySecret('email_for_password_reset',self.secret)
     return passwordResetLink
Esempio n. 4
0
 def the_reset_link_is_in_the_reset_email(self):
     self._sendPasswordResetEmail()
     text = self.outbox[0].html
     soup = BeautifulSoup(text, "lxml")
     passwordResetLink = soup.find("a")['href']
     self.secret = passwordResetLink.split('secret=')[1]
     self.tempcred = Credential.getBySecret('email_for_password_reset',
                                            self.secret)
     return passwordResetLink
Esempio n. 5
0
 def doDeregistrationDoit(self, form):
     Credential.deleteExpired('deregister')
     secret = form.deregister_secret.data
     if secret is None:
         raise ReportedError(
             [secretIsNeededForDeregistrationDoit],400)
     deregistrationCredential = Credential.getBySecret('deregister', secret)
     if deregistrationCredential is None:
         raise ReportedError([badDeregistrationSecret],400)
     user = deregistrationCredential.user
     self.removeUser(user)
     return self.simple_response(youAreDeregistered)
Esempio n. 6
0
 def doDeregistrationDoit(self, form):
     Credential.deleteExpired('deregister')
     secret = form.deregister_secret.data
     if secret is None:
         raise ReportedError(
             [secretIsNeededForDeregistrationDoit],400)
     deregistrationCredential = Credential.getBySecret('deregister', secret)
     if deregistrationCredential is None:
         raise ReportedError([badDeregistrationSecret],400)
     user = deregistrationCredential.user
     self.removeUser(user)
     return self.simple_response(youAreDeregistered)
Esempio n. 7
0
 def doPasswordReset(self, form):
     Credential.deleteExpired(self.passwordResetCredentialType)
     cred = Credential.getBySecret(
         self.passwordResetCredentialType, form.secret.data)
     if cred is None or (cred.getExpirationTime() < time.time()):
         raise ReportedError([theSecretHasExpired], 404)
     passcred = Credential.getByUser(cred.user, 'password')
     protectedSecret = CredentialManager.protect_secret(form.password.data)
     if not passcred:
         passcred = Credential.new(cred.user, "password", cred.user.email, protectedSecret)
     else:
         passcred.secret = protectedSecret
     cred.rm()
     return self.simple_response(passwordSuccessfullyChanged)
Esempio n. 8
0
 def doPasswordReset(self, form):
     Credential.deleteExpired(self.passwordResetCredentialType)
     cred = Credential.getBySecret(
         self.passwordResetCredentialType, form.secret.data)
     if cred is None or (cred.getExpirationTime() < time.time()):
         raise ReportedError([theSecretHasExpired], 404)
     passcred = Credential.getByUser(cred.user, 'password')
     protectedSecret = CredentialManager.protect_secret(form.password.data)
     if not passcred:
         passcred = Credential.new(cred.user, "password", cred.user.email, protectedSecret)
     else:
         passcred.secret = protectedSecret
     cred.rm()
     return self.simple_response(passwordSuccessfullyChanged)
Esempio n. 9
0
 def getCredentialForEmailverifyToken(self, token):
     cred = Credential.getBySecret('emailcheck', token)
     return cred
Esempio n. 10
0
 def getCredentialForEmailverifyToken(self, token):
     cred = Credential.getBySecret('emailcheck', token)
     return cred