Example #1
0
def view_user(user_id):
    """
        View a single user activity
        Useful for executive report
    """
    myuser = api.usercontrol.get_by_id(user_id)
    if myuser is None:
        flash("User not found...", "error")
        return redirect(url_for("index"))

    chnickform = ChgNickForm()
    chthemeform = ChgThemeForm()
    chnameform = ChgNameForm()
    chpassform = ChgPassForm()
    if myuser.id == g.user.id:
        if chthemeform.validate_on_submit():
            api.usercontrol.set_theme(myuser, chthemeform.newtheme.data)
        if chnameform.validate_on_submit():
            api.usercontrol.set_name(myuser, chnameform.newname.data)
        if chnickform.validate_on_submit():
            api.usercontrol.set_nick(myuser, chnickform.newnick.data)
        if chpassform.validate_on_submit():
            if api.usercontrol.check_user_pass(myuser,
                                               chpassform.oldpass.data):
                api.usercontrol.set_pass(myuser, chpassform.password.data)
    return render_template('user.html',
                           chnickform=chnickform,
                           chthemeform=chthemeform,
                           chpassform=chpassform,
                           chnameform=chnameform,
                           user=myuser)
Example #2
0
def view_user(user_id):
    """
        View a single user activity
        Useful for executive report
    """
    myuser = api.usercontrol.get_by_id(user_id)
    if myuser is None:
        flash("User not found...", "error")
        return redirect(url_for('webuiview.index'))

    chnickform = ChgNickForm()
    chthemeform = ChgThemeForm()
    chnameform = ChgNameForm()
    chpassform = ChgPassForm()
    if myuser.id == g.user.id:
        if chthemeform.validate_on_submit():
            api.usercontrol.set_theme(myuser, chthemeform.newtheme.data)
        if chnameform.validate_on_submit():
            api.usercontrol.set_name(myuser, chnameform.newname.data)
        if chnickform.validate_on_submit():
            api.usercontrol.set_nick(myuser, chnickform.newnick.data)
        if chpassform.validate_on_submit():
            if api.usercontrol.check_user_pass(
                    myuser, chpassform.oldpass.data):
                api.usercontrol.set_pass(myuser, chpassform.password.data)
                flash("Changed user password", "success")
    return render_template('user.html',
                           chnickform=chnickform,
                           chthemeform=chthemeform,
                           chpassform=chpassform,
                           chnameform=chnameform,
                           user=myuser)