示例#1
0
文件: auth.py 项目: fohnwind/fae
def login():

    if current_user is not None and current_user.is_authenticated():
        return redirect(url_for("user.index"))

    # print request.form
    form = LoginForm(request.form)

    #if form.validate_on_submit():
    if True:
        user, authenticated = User.authenticate(form.username.data,
                                                form.password.data)

        if user and authenticated:
            print user.username
            login_user(user, remember=form.remember_me.data)

            return redirect(request.args.get("next") or
                            url_for('user.index'))

        flash("wrong Username of Password.", "danger")

    return render_template("auth/login.html", form=form)
示例#2
0
文件: auth.py 项目: fohnwind/fae
    def save(self):
        print self.password.data
        user = User(username=self.username.data,
                    password=self.password.data)

        return user.save()