コード例 #1
0
    def post(self):

        username = self.get_argument('username', None)
        password = self.get_argument('password', None)

        print 'self.request = ', self.request

        print 'username = '******'password = '******'U = ', U
        if not U:
            return self.write_fail(_('No such user.'))

        if U:
            if U.is_locked:
                return self.write_fail(_('User is locked'))

        if not check_login_passwd(password, U.password):
            return self.write_fail(_('Password is wrong.'))

        session_key = self.save_session(U.id)

        U.last_login = datetime.datetime.now()

        self.db.commit()

        self.write_success(_('Welcome to LYC.'), session_key=session_key)
コード例 #2
0
ファイル: views.py プロジェクト: afeide/LuoYunCloud
    def post(self):

        username = self.get_argument('username', None)
        password = self.get_argument('password', None)

        print 'self.request = ', self.request

        print 'username = '******'password = '******'U = ', U
        if not U:
            return self.write_fail( _('No such user.') )

        if U:
            if U.is_locked:
                return self.write_fail( _('User is locked') )

        if not check_login_passwd( password, U.password ):
            return self.write_fail( _('Password is wrong.') )

        session_key = self.save_session( U.id )

        U.last_login = datetime.datetime.now()

        self.db.commit()

        self.write_success( _('Welcome to LYC.'),
                            session_key = session_key )
コード例 #3
0
ファイル: forms.py プロジェクト: weizai118/LuoYunCloud
    def validate_password(form, field):

        if '@' in form.user.data:
            user = form._handler.db.query(User).filter_by(
                email=form.user.data).first()
        else:
            user = form._handler.db.query(User).filter_by(
                username=form.user.data).first()

        if user:
            if not check_login_passwd(field.data, user.password):
                raise ValidationError(_('Password is wrong.'))
コード例 #4
0
ファイル: forms.py プロジェクト: afeide/LuoYunCloud
    def validate_password(form, field):

        if '@' in form.user.data:
            user = form._handler.db.query(User).filter_by(
                email = form.user.data ).first()
        else:
            user = form._handler.db.query(User).filter_by(
                username = form.user.data ).first()

        if user:
            if not check_login_passwd( field.data,
                                       user.password ):
                raise ValidationError( _('Password is wrong.') )