Ejemplo n.º 1
0
def self():
    email = request.form['email']
    user_mail = User.query.filter(User.email == email).all()
    if not user_mail:
        u = uuid.uuid4()
        userid = str(u)
        user = User(userid)
        user.email = email
        user.accepted = True
        db_session.add(user)
        db_session.commit()
    else:
        return render_template('error_poll.html',
                               message="Usuario existente go to: " +
                               current_app.config['BASE_NAME'] +
                               url_for('.login', userid=user_mail[0].userid))
    return redirect(url_for('.index'))
Ejemplo n.º 2
0
def user_invite():
    """Invite a user via email"""
    project = request.cookies.get('project')
    if not project:
        return render_template('error.html',message="Proyecto no seleccionado",recent=recent.get())
    form=UserInviteF(request.form)
    if form.cancel.data:
        return redirect(url_for('.dashboard'))
    if form.validate_on_submit():
        user_mail=User.query.filter(User.email==form.email.data).all()
        if not user_mail:
            u=uuid.uuid4()
            userid=str(u)
            user=User(userid)
            user.accepted=True
            form.populate_obj(user)
            db_session.add(user)
            db_session.commit()
            return redirect(url_for('.user_info',userid=userid))
        else:
            return render_template('error.html',message="Usuario ["+form.email.data+"] ya definido con id:"+user_mail[0].userid,recent=recent.get())
    else:
        return render_template('email_edit.html',form=form,recent=recent.get())
Ejemplo n.º 3
0
def user_new():
    """Create a user email"""
    form=UserInviteF(request.form)
    if form.cancel.data:
        return redirect(url_for(dashboard))
    if form.validate_on_submit():
        user_mail=User.query.filter(User.email==form.email.data).all()
        if not user_mail:
            u=uuid.uuid4()
            userid=str(u)
            user=User(userid)
            user.email=form.email.data
            user.accepted=True
            db_session.add(user)
            db_session.commit()
            return render_template('user_created.html',
                    userid=userid,
                    servername=current_app.config['BASE_NAME'],
                    recent=recent.get())
        else:
            return render_template('error.html',message="Usuario ["+form.email.data+"] ya definido con id:"+user_mail[0].userid,recent=recent.get())
    else:
        return render_template('email_edit.html',form=form,recent=recent.get(),opt="crear")