def registerCertUser(self, email, identifier, digest, cred): if email is None: raise ReportedError([youHaveToRegisterFirst], 403) theEmail = email[0] CredentialManager.create_user_with_creds("certificate", identifier, digest, theEmail) cred = Credential.get("certificate", identifier) self.sendPasswordVerificationEmail(cred.user) return cred
def test_user_can_login_with_facebook_for_a_served_application(self): user = config.facebookUser1 CredentialManager.create_user_with_creds( 'facebook', user.userid, user.userid, user.email) self.callOauthUri() self.pushFbButtonWhenready(buttonId="login_facebook_button") self.handleFbLoginPage(user) self.waitForJsState('myApps') self.click("acceptance_accept") self.assertReachedRedirectUri()
def registerCertUser(self, cert, email): if cert is None or cert == '': raise ReportedError(["No certificate given"], 403) identifier, digest = self.parseCert(cert) cred = Credential.get("certificate", identifier) if cred is None: if email is None: raise ReportedError(["You have to register first"], 403) theEmail = email[0] CredentialManager.create_user_with_creds("certificate", identifier, digest, theEmail) cred = Credential.get("certificate", identifier) self.sendPasswordVerificationEmail(cred.user) cred.user.activate() return cred
def test_User_with_credential_can_be_deleted(self): self.setupUserCreationData() cred = CredentialManager.create_user_with_creds( 'password', self.userCreationUserid, self.usercreationPassword, self.userCreationEmail) cred.user.rm()
def test_User_email_is_be_stored(self): self.setupUserCreationData() cred = CredentialManager.create_user_with_creds( 'password', self.userCreationUserid, self.usercreationPassword, self.userCreationEmail) self.assertEqual(cred.user.email, self.userCreationEmail)
def User_email_can_be_stored(self): self.setupRandom() email = "email{0}@example.com".format(self.randString) userid = "aaa_{0}".format(self.randString) password = "******".format(self.randString) user = CredentialManager.create_user_with_creds('password', userid, password, email) self.assertEquals(user.email, email)
def test_User_hash_can_be_stored(self): self.setupUserCreationData() digest = self.createHash() cred = CredentialManager.create_user_with_creds( 'password', self.userCreationUserid, self.usercreationPassword, self.userCreationEmail, digest) self.assertEqual(cred.user.hash, digest)
def createUserWithCredentials(self, credType='password', userid=None, password=None, email=None): self.setupUserCreationData(userid, password, email) cred = CredentialManager.create_user_with_creds( credType, self.userCreationUserid, self.usercreationPassword, self.userCreationEmail) cred.user.activate() return cred
def getAssurerUser(): userName = "******" password = "******" assurerEmail = "*****@*****.**" user = User.getByEmail(assurerEmail) if not user: user = CredentialManager.create_user_with_creds('password', userName, password, assurerEmail).user user.activate() Assurance.new(user, "assurer", user).save() Assurance.new(user, "assurer.test", user).save() user.password=password user.userName=userName return user
def getAssurerUser(): userName = "******" password = "******" assurerEmail = "*****@*****.**" user = User.getByEmail(assurerEmail) if not user: user = CredentialManager.create_user_with_creds( 'password', userName, password, assurerEmail).user user.activate() Assurance.new(user, "assurer", user).save() Assurance.new(user, "assurer.test", user).save() user.password = password user.userName = userName return user
def test_user_can_login_with_password_for_a_served_application(self): cred=CredentialManager.create_user_with_creds( 'password', self.userCreationUserid, self.usercreationPassword, self.userCreationEmail) self.callOauthUri() self.beginProcess("login with password in app") self.fillInField("LoginForm_email_input", self.userCreationUserid) self.fillInField("LoginForm_password_input", self.usercreationPassword) self.click("loginform_submit-button") self.waitForJsState("myApps") self.click("acceptance_accept") self.endProcess("login with password in app") self.assertReachedRedirectUri()
def doRegistration(self, form): Credential.deleteExpired('emailcheck') cred = CredentialManager.create_user_with_creds( form.credentialType.data, form.identifier.data, form.password.data, form.email.data, None) user = cred.user additionalInfo = self.checkAndUpdateHash(form, user) self.sendPasswordVerificationEmail(user) user.set_authenticated() user.activate() success = self.loginInFramework(cred) if success: return self.returnUserAndLoginCookie(user, additionalInfo)
def _do_registration(self, form): additionalInfo = {} digest = form.digest.data if digest == '': digest = None if digest is not None: anotherUsers = User.getByDigest(form.digest.data) if anotherUsers: if self.isAnyoneHandAssurredOf(anotherUsers): raise ReportedError([anotherUserUsingYourHash], 400) additionalInfo["message"] = anotherUserUsingYourHash user = CredentialManager.create_user_with_creds( form.credentialType.data, form.identifier.data, form.secret.data, form.email.data, digest) self.sendPasswordVerificationEmail(user) user.set_authenticated() user.activate() r = self.loginUserInFramework(user) if r: return self.returnUserAndLoginCookie(user, additionalInfo)
def createUserWithCredentials(self, credType='password', userid=None, password=None, email=None): userid, password, email = self.setupUserCreationData(userid, password, email) user = CredentialManager.create_user_with_creds(credType, userid, password, email) self.assertTrue(user) return user