private void SendLoginError(Connection conn, LoginErrors error) { Debug.LogError("Authentification refused. Reason : " + error.ToString()); LoginErrorMessage err = new LoginErrorMessage(); err.ErrorCode = error; conn.SendMessage(err); conn.Disconnect(); }
public IActionResult Login( [FromQuery] LoginErrors error = LoginErrors.Ok, [FromQuery] string returnUrl = "", [FromQuery] string display = "") { // TODO: Anti forgery token for login var data = JsonConvert.SerializeObject(new { Display = display, Error = error.ToString(), FormMethod = "POST", FormAction = Url.Action(nameof(LoginPost), new { returnUrl = returnUrl, display = display }), FormData = new { Email = "", Password = "", RememberMe = "", } }, _mvcJsonOptions.SerializerSettings); return(new ContentResult() { Content = $@"<!DOCTYPE html> <html> <head> <script>var OPENID_LOGIN_PAGE = {data};</script> {_brandingHtml?.Login} </head> <body> <form action=""{Url.Action(nameof(LoginPost), new { returnUrl = returnUrl, display = display })}"" method=""POST""> <input type=""email"" name=""Email"" placeholder=""EMAIL"" required /> <input type=""password"" name=""Password"" placeholder=""PASSWORD"" required /> <input type=""checkbox"" name=""RememberMe"" value=""1"" title=""REMEMBER_ME"" /> <button type=""submit"">LOGIN</button> ", ContentType = "text/html; charset=utf8" }); }
//////////////////////////////////////////////////////////////////////////////////////////////// /*--------------------------------------------------------------------------------------------*/ public OauthException NewFault(LoginErrors pErr, LoginErrorDescs pDesc) { return(new OauthException(pErr.ToString(), ErrDescStrings[(int)pDesc])); }
/*--------------------------------------------------------------------------------------------*/ public static void CheckException(OauthException pEx, LoginErrors pErr, LoginErrorDescs pDesc) { Assert.AreEqual(pErr.ToString(), pEx.OauthError.Error, "Incorrect Error."); Assert.AreEqual(OauthLoginTasks.ErrDescStrings[(int)pDesc], pEx.OauthError.ErrorDesc, "Incorrect ErrorDesc."); }