public void LoginButton() { //Llama la función del autentificador para intentar iniciar sesión entregándole los valores de los inputs correspondientes. //Además actualiza la UI del menú según la respuesta del autentificador. UserAuthentication.AuthStates authenticantionAnswer = Authentication.TryLogin(userLogin.text, passLogin.text); if (authenticantionAnswer == UserAuthentication.AuthStates.OK) { statusLogin.text = "¡Bienvenido " + userLogin.text + "!"; userLogin.readOnly = true; passLogin.readOnly = true; buttonLogin.SetActive(false); panelJugar.SetActive(true); } else if (authenticantionAnswer == UserAuthentication.AuthStates.WrongPassword) { statusLogin.text = "Contraseña incorrecta."; passLogin.text = ""; } else { statusLogin.text = "Usuario no registrado."; userLogin.text = ""; passLogin.text = ""; } }
public void CreateUserButton() { //Llama la función del autentificador para intentar crear un usuario entregándole los valores de los inputs correspondientes. //Además actualiza la UI del menú según la respuesta del autentificador. UserAuthentication.AuthStates authenticantionAnswer = Authentication.TryCreateUser(userSignUp.text, passSignUp.text); if (authenticantionAnswer == UserAuthentication.AuthStates.OK) { statusSignUp.text = "¡Usuario creado!"; passSignUp.readOnly = true; userSignUp.readOnly = true; buttonSignUp.SetActive(false); panelJugar.SetActive(true); } else if (authenticantionAnswer == UserAuthentication.AuthStates.WrongPassword) { statusSignUp.text = "Tu contraseña tiene que tener al menos 6 caracteres."; passSignUp.text = ""; } else { statusSignUp.text = "Ya existe un usuario con ese nombre."; userSignUp.text = ""; passSignUp.text = ""; } }