示例#1
0
 private void SetNavigation(LoginErrors errors, ErrorViewModel model)
 {
     if (errors != null)
     {
         model.Navigations   = GetLangNavigation();
         model.TechnicalInfo = errors.Common.TechnicalInformation;
         model.ContactInfo   = errors.Common.ContactInformation;
     }
 }
示例#2
0
    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();
    }
示例#3
0
        /*--------------------------------------------------------------------------------------------*/
        private void AssertFault(TestDelegate pDelegate, LoginErrors pError, LoginErrorDescs pDesc)
        {
            OauthException oe = TestUtil.Throws <OauthException>(pDelegate);

            Assert.NotNull(oe.OauthError, "OauthError should filled.");
            Assert.AreEqual(pError + "", oe.OauthError.Error, "Invalid OauthError.Error");
            Assert.AreEqual(OauthLoginTasks.ErrDescStrings[(int)pDesc] + "",
                            oe.OauthError.ErrorDesc, "Invalid OauthError.ErrorDesc");
        }
        /*--------------------------------------------------------------------------------------------*/
        private void AssertFault(LoginErrors pError, LoginErrorDescs pDesc)
        {
            var oe = new OauthException(null, null);

            vMockTasks
            .Setup(x => x.NewFault(pError, pDesc))
            .Returns(oe);

            OauthException thrown = TestUtil.Throws <OauthException>(DoExecute);

            Assert.AreEqual(oe, thrown, "Incorrect thrown OauthException.");
        }
示例#5
0
 public LoginException(string error)
     : base(error)
 {
     if (error.Contains("code"))
     {
         this.error = LoginErrors.CaptchaError;
     }
     else if (error.Contains("username"))
     {
         this.error = LoginErrors.PassError;
     }
     else
     {
         this.error = LoginErrors.AnotherError;
     }
 }
示例#6
0
        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"
            });
        }
示例#7
0
 public LoginErrorMessage(LoginErrors error)
     : this()
 {
     ErrorCode = error;
 }
示例#8
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 public OauthException NewFault(LoginErrors pErr, LoginErrorDescs pDesc)
 {
     return(new OauthException(pErr.ToString(), ErrDescStrings[(int)pDesc]));
 }
示例#9
0
 private IActionResult RedirectToLogin(LoginErrors error, String returnUrl, String display = "")
 {
     return(RedirectToAction(nameof(Login), new { error = error, returnUrl = returnUrl, display = display }));
 }
示例#10
0
 /*--------------------------------------------------------------------------------------------*/
 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.");
 }