Beispiel #1
0
 def save(self):
     user = UserMan(username=self.username.data,
                 email=self.email.data,
                 password=self.password.data,
                 date_joined=datetime.utcnow(),
                 primary_group_id=4,
                 language=self.language.data)
     return user.save()
Beispiel #2
0
def login():
    """
    Logs the user in
    """

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

    form = LoginForm(request.form)
    if form.validate_on_submit():
        user, authenticated = UserMan.authenticate(form.login.data,
                                                form.password.data)

        if user and authenticated:
            login_user(user, remember=form.remember_me.data)
            return redirect(request.args.get("next") or
                            url_for("forum.index"))

        flash(_("Wrong Username or Password."), "danger")
    return render_template("auth/login.html", form=form)