Ejemplo n.º 1
0
def register_post():
    vm = RegisterViewModel()
    vm.validate()

    # for the beta:
    if vm.admin != True:
        vm.error = "Account creation is limited during the closed beta."

    if vm.error:
        return vm.to_dict()

    security_class = security_service.find_default_security_class()
    user = user_service.create_user(vm.name, vm.email, vm.password,
                                    security_class)
    if not user:
        vm.error = "The account could not be created"
        return vm.to_dict()

    success = user_service.send_activation_email(user)
    if success != True:
        vm.error = "The activation email failed to send. Please contact the site administrator for help."
        return vm.to_dict()

    resp = flask.redirect("/")

    return resp
Ejemplo n.º 2
0
def index_post():
    vm = RegisterViewModel()
    vm.validate()

    if vm.error:
        return vm.to_dict()

    user = user_service.create_user(vm.name, vm.email)

    if not user:
        vm.error = 'The account could not be created.'
        return vm.to_dict()

    return flask.redirect('/users')
Ejemplo n.º 3
0
def register_post():
    vm = RegisterViewModel()
    vm.validate()

    if vm.error:
        return vm.to_dict()

    user = user_service.create_user(vm.name, vm.email, vm.password)
    if not user:
        vm.error = 'The account could not be created'
        return vm.to_dict()

    resp = flask.redirect('/account')
    cookie_auth.set_auth(resp, user.id)
    return resp
Ejemplo n.º 4
0
async def register(request: Request):
    vm = RegisterViewModel(request)
    await vm.load()

    if vm.error:
        return vm.to_dict()

    # Create the account
    account = user_service.create_account(vm.name, vm.email, vm.password)
    # Login user

    response = fastapi.responses.RedirectResponse(
        url='/account', status_code=status.HTTP_302_FOUND)
    cookie_auth.set_auth(response, account.id)
    return response
def register_get():
    vm = RegisterViewModel()
    return vm.to_dict()
Ejemplo n.º 6
0
def register(request: Request):
    vm = RegisterViewModel(request)
    return vm.to_dict()
Ejemplo n.º 7
0
def index_get():
    vm = RegisterViewModel()
    return vm.to_dict()