Beispiel #1
0
    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="/"))
Beispiel #2
0
    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))
Beispiel #3
0
    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))
Beispiel #4
0
    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='/'))
Beispiel #5
0
    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))
Beispiel #6
0
    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
Beispiel #7
0
    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))
Beispiel #8
0
 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)
Beispiel #9
0
    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)
Beispiel #13
0
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)
Beispiel #15
0
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
Beispiel #16
0
def test_roundtrip():
    p = passwd("passphrase")
    assert passwd_check(p, "passphrase") is True
Beispiel #17
0
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)
Beispiel #18
0
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)
Beispiel #20
0
def test_roundtrip():
    p = passwd("passphrase")
    nt.assert_equal(passwd_check(p, "passphrase"), True)