예제 #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                Authenticator.AuthenticateUser(txtEmail.Text, txtPassword.Text);

                //this gets the page they were trying to access
                string url = FormsAuthentication.GetRedirectUrl(txtEmail.Text, false);

                //sets ASP.net Forms auth cookie
                FormsAuthentication.SetAuthCookie(txtEmail.Text, true);

                //set the expiration to 14 days from today
                HttpCookie cookie = Response.Cookies[FormsAuthentication.FormsCookieName];
                cookie.Expires = DateTime.Now + new TimeSpan(14, 0, 0, 0);

                //redirect them to the request page
                Response.Redirect("dashboard.aspx", false);
            }
            catch (Exception ex)
            {
                Output.Text    = ex.Message;
                Output.Visible = true;
            }
        }
예제 #2
0
 private string GetJiraDescription(string JiraId)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(JiraId) == false)
         {
             Issue jiraIssue = this.myJira.Issues.GetIssueAsync(JiraId).Result;
             if (jiraIssue != null)
             {
                 return(jiraIssue.Summary);
             }
         }
     }
     catch (Exception e)
     {
         try
         {
             if (Authenticator.AuthenticateUser())
             {
                 throw e.InnerException;
             }
             else
             {
                 throw;
             }
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(string.Empty);
 }
예제 #3
0
        public ValidLogin()
        {
            var app = new Application("*****@*****.**", "password", "password");

            new Registrator().ApplyForMembership(app);
            var auth = new Authenticator();

            _result = auth.AuthenticateUser(new Credentials {
                Email = "*****@*****.**", Password = "******"
            });
        }
예제 #4
0
        public async Task <IActionResult> AuthenticateUser([FromBody] UserAuthTokenDto User)
        {
            Authenticator Auth = new Authenticator();

            if (!Auth.AuthenticateUser(User.Token, _context))
            {
                return(StatusCode(401));
            }

            return(Ok());
        }
예제 #5
0
 void userControlJiraLogging1_OnSaveButtonClick(object sender, EventArgs args)
 {
     try
     {
         Authenticator.AuthenticateUser();
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error logging to JIRA.", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #6
0
        private static async Task LogUserPlayAsync(string userName, string password, DateTime date, string location, int quantity, int?gameId, string gameName, int length, bool incomplete, bool noWinStats, string comments)
        {
            if (gameId == null)
            {
                gameId = 1; //TODO search for game name
            }
            var bggService    = new BggService();
            var authenticator = new Authenticator(bggService);
            await authenticator.AuthenticateUser(userName, password);

            var logger = new Logger(bggService);
            await logger.LogPlay(date, location, quantity, gameId.Value, length, incomplete, noWinStats, comments);
        }
예제 #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CommandLineParser.Parse();

            hMailServer.Application application = new hMailServer.Application();
            if (!Authenticator.AuthenticateUser(application))
            {
                return;
            }

            Globals.SetApp(application);

            Application.Run(new formMain());
        }
예제 #8
0
        private static void CreateDatabase()
        {
            string adminPassword = string.Empty;

            if (CommandLineParser.ContainsArgument("password"))
            {
                adminPassword = CommandLineParser.GetArgument("password");
            }

            if (!Authenticator.AuthenticateUser(_application, adminPassword))
            {
                return;
            }

            if (_application.Database.DatabaseType == hMailServer.eDBtype.hDBTypeMSSQLCE ||
                _application.Database.DatabaseType == hMailServer.eDBtype.hDBTypeUnknown)
            {
                InitializeInternalDatabase();
            }
        }
예제 #9
0
        private static Task LoginUserAsync(string userName, string password)
        {
            var authenticator = new Authenticator(new BggService());

            return(authenticator.AuthenticateUser(userName, password));
        }
예제 #10
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string databaseOldErrorMessage = "The database is too old for this version of hMailServer.";

            try
            {
                CommandLineParser.Parse();

                hMailServer.Application application = new hMailServer.Application();

                try
                {
                    application.Connect();
                }
                catch (Exception ex)
                {
                    if (!ex.Message.Contains(databaseOldErrorMessage))
                    {
                        throw ex;
                    }
                }


                int from = application.Database.CurrentVersion;
                int to   = application.Database.RequiredVersion;

                if (from == to)
                {
                    if (!CommandLineParser.ContainsArgument("/SilentIfOk") && !CommandLineParser.IsSilent())
                    {
                        MessageBox.Show("Your hMailServer database is already up to date.", "hMailServer Administrator");
                    }

                    return;
                }

                if (!Authenticator.AuthenticateUser(application))
                {
                    return;
                }

                formMain main = new formMain(application);

                if (!main.LoadSettings())
                {
                    return;
                }

                if (!main.CreateUpgradePath())
                {
                    return;
                }

                if (CommandLineParser.IsSilent())
                {
                    // Silently perform the upgrade
                    main.DoUpgrade();
                    return;
                }

                // Do it the default way.
                Application.Run(main);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + Environment.NewLine + Environment.NewLine + "Please check the hMailServer error log for further details.", "hMailServer Administrator", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #11
0
 public AuthenticationResult Authenticate(string email, string password, string ip = "192.168.64.1")
 {
     return(_auth.AuthenticateUser(new Credentials(email, password, ip)));
 }