def post(self): pwd = self.get_argument("password", default=u"") if self.application.password: if passwd_check(self.application.password, pwd): self.set_secure_cookie("username", str(uuid.uuid4())) else: self._render(message={"error": "Invalid password"}) return self.redirect(self.get_argument("next", default="/"))
def post(self): pwd = self.get_argument('password', default=u'') if self.login_available: if passwd_check(self.password, pwd): self.set_secure_cookie(self.cookie_name, str(uuid.uuid4())) else: self._render(message={'error': 'Invalid password'}) return self.redirect(self.get_argument('next', default=self.base_project_url))
def post(self): pwd = self.get_argument('password', default=u'') if self.application.password: if passwd_check(self.application.password, pwd): self.set_secure_cookie('username', str(uuid.uuid4())) else: self._render(message={'error': 'Invalid password'}) return self.redirect(self.get_argument('next', default='/'))
def post(self): pwd = self.get_argument('password', default=u'') if self.application.password: if passwd_check(self.application.password, pwd): self.set_secure_cookie('username', str(uuid.uuid4())) else: self._render(message={'error': 'Invalid password'}) return self.redirect(self.get_argument('next', default=self.application.ipython_app.base_project_url))
async def authenticate(self, handler, data): username = data['username'] password = data['password'] if username in self.admin_users: to_check = self.admin_password_hash else: to_check = self.student_password_hash if passwd_check(to_check, password): return username else: return None
def post(self): pwd = self.get_argument('password', default=u'') if self.application.password: if passwd_check(self.application.password, pwd): self.set_secure_cookie(self.settings['cookie_name'], str(uuid.uuid4())) else: self._render(message={'error': 'Invalid password'}) return self.redirect( self.get_argument( 'next', default=self.application.ipython_app.base_project_url))
def post(self): typed_password = self.get_argument('password', default=u'') if self.login_available(self.settings): if passwd_check(self.hashed_password, typed_password): # tornado <4.2 have a bug that consider secure==True as soon as # 'secure' kwarg is passed to set_secure_cookie if self.settings.get('secure_cookie', self.request.protocol == 'https'): kwargs = {'secure':True} else: kwargs = {} self.set_secure_cookie(self.cookie_name, str(uuid.uuid4()), **kwargs) else: self._render(message={'error': 'Invalid password'}) return next_url = self.get_argument('next', default=self.base_url) if not next_url.startswith(self.base_url): # require that next_url be absolute path within our path next_url = self.base_url self.redirect(next_url)
def post(self): typed_password = self.get_argument('password', default=u'') if self.login_available(self.settings): if passwd_check(self.hashed_password, typed_password): # tornado <4.2 have a bug that consider secure==True as soon as # 'secure' kwarg is passed to set_secure_cookie if self.settings.get('secure_cookie', self.request.protocol == 'https'): kwargs = {'secure': True} else: kwargs = {} self.set_secure_cookie(self.cookie_name, str(uuid.uuid4()), **kwargs) else: self._render(message={'error': 'Invalid password'}) return next_url = self.get_argument('next', default=self.base_url) if not next_url.startswith(self.base_url): # require that next_url be absolute path within our path next_url = self.base_url self.redirect(next_url)
def test_passwd_check_unicode(): # GH issue #4524 phash = u'sha1:23862bc21dd3:7a415a95ae4580582e314072143d9c382c491e4f' assert passwd_check(phash, u"łe¶ŧ←↓→")
def test_bad(): p = passwd('passphrase') nt.assert_equal(passwd_check(p, p), False) nt.assert_equal(passwd_check(p, 'a:b:c:d'), False) nt.assert_equal(passwd_check(p, 'a:b'), False)
def test_roundtrip(): p = passwd('passphrase') nt.assert_equal(passwd_check(p, 'passphrase'), True)
def test_bad(): p = passwd("passphrase") nt.assert_equal(passwd_check(p, p), False) nt.assert_equal(passwd_check(p, "a:b:c:d"), False) nt.assert_equal(passwd_check(p, "a:b"), False)
def test_roundtrip(): p = passwd('passphrase') nt.assert_equals(passwd_check(p, 'passphrase'), True)
def test_bad(): p = passwd('passphrase') assert passwd_check(p, p) is False assert passwd_check(p, "a:b:c:d") is False assert passwd_check(p, "a:b") is False
def test_roundtrip(): p = passwd("passphrase") assert passwd_check(p, "passphrase") is True
def test_roundtrip(): p = passwd("passphrase") nt.assert_equal(passwd_check(p, "passphrase"), True)
def test_bad(): p = passwd('passphrase') nt.assert_equals(passwd_check(p, p), False) nt.assert_equals(passwd_check(p, 'a:b:c:d'), False) nt.assert_equals(passwd_check(p, 'a:b'), False)