예제 #1
0
        private static void Main(string[] args)
        {
            var authService = new AccountService();
            var user        = CLIHandler.CreateUser();

            var registerResponse = authService.Register(user.Username, user.Password);

            if (!VerifyResponse(registerResponse, Messages.SuccessRegistrationMsg))
            {
                Console.ReadKey();
                return;
            }
            var loginResponse = authService.Login(user.Username, user.Password);

            if (!VerifyResponse(loginResponse, Messages.SuccessLoginMsg))
            {
                Console.ReadKey();
                return;
            }
            var changePasswordResponse = ChangePassword(loginResponse.Data.AuthToken, authService, user);

            if (VerifyResponse(changePasswordResponse, Messages.SuccessChangePasswordMsg))
            {
                Console.ReadKey();
                return;
            }

            Console.ReadKey();
        }
예제 #2
0
        private static IRestResponse ChangePassword(string accessToken, AccountService authService, User user)
        {
            var newPassword = CLIHandler.CreateNewPassword();
            var response    = authService.ChangePassword(user.Password, newPassword.NewPassword, accessToken);

            return(response);
        }
예제 #3
0
        internal static void ProcessInitialize(params string[] args)
        {
            // If the user passed any arguments, run them in CLI mode.
            if (args.Any())
            {
                CurrentContext = MefinoContext.CLI;
                CoreInit();

                CLIHandler.Execute(args);
            }
            else // Otherwise launch the GUI.
            {
#if RELEASE
                // Show a console if DEBUG build.
                CLIHandler.HideConsole();
#endif
                CurrentContext = MefinoContext.GUI;
                CoreInit();

                if (SelfUpdater.CheckUpdatedWanted())
                {
                    return;
                }

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Application.Run(new MefinoGUI());
            }
        }