Experiencias y Reglas: Creación de Experiencia de registro de usuarios

 

Aquí te dejamos el código utilizado en esta lección:


Experience SignUp {
    String title value("Create account!") as Label
    String username label("username") as TextField
    String password label("password") as TextField 
    String repeatPassword label("repeat password") as TextField

    Decision createAccount action("SignUpContext.createAccount") label("create account")
}

Experience Welcome {
    String greetings label("Welcome!") as Label
}

RuleContext LoginContext {
    Rule login {
        Login loginExp = broker.ui.getDataSource()
        Welcome welcomeDataSource = Welcome()
        welcomeDataSource.greetings = "Welcome " + loginExp.username + " to the treasure hunt app!"
        broker.ui.push(“Welcome”, welcomeDataSource)
    }
    Rule signUp {
        broker.ui.push(“SignUp”)
    }
}