public SettingsController(ApiService apiService, JwtHelper jwtHelper, LogInHandler logInHandler, EncryptionService encryptionService)
 {
     _apiService        = apiService;
     _jwtHelper         = jwtHelper;
     _logInHandler      = logInHandler;
     _encryptionService = encryptionService;
 }
Exemple #2
0
 public AuthController(IDataProtectionProvider provider, ApiService apiService, JwtHelper jwtHelper, LogInHandler logInHandler, IConfiguration config, EncryptionService encryptionService, NotificationService notify)
 {
     _apiService          = apiService;
     dataProtectionHelper = new DataProtectionHelper(provider);
     cookieHandler        = new CookieHandler(new HttpContextAccessor(), provider, config);
     _jwtHelper           = jwtHelper;
     _logInHandler        = logInHandler;
     _encryptionService   = encryptionService;
     _notify = notify;
 }
Exemple #3
0
        //Menu
        public async void LogIn()
        {
            LogInHandler logInHandler = new LogInHandler();
            Task         loadDataTask = logInHandler.LoadData();
            Task         saveDataTask = Task.CompletedTask;

            Console.WriteLine("Welcome to Expence Manager. Please log in or register.");
            PrintHead();
            while (true)
            {
                Console.Write("[USER]: ");
                string cmd  = Console.ReadLine();
                string name = "";
                string pass = "";
                switch (cmd)
                {
                case "0":     //CLOSE
                    await saveDataTask;
                    return;

                case "1":     //LOGIN
                    GetUserData(ref name, ref pass);
                    Console.Clear();
                    await loadDataTask;
                    User  current = logInHandler.Validate(name, pass);
                    if (current != null)
                    {
                        current.Run();
                    }
                    break;

                case "2":     //REGISTER
                    GetUserData(ref name, ref pass);
                    Console.Clear();
                    await loadDataTask;
                    if (logInHandler.Register(name, pass))
                    {
                        saveDataTask = logInHandler.SaveData();
                    }
                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("ERROR: Invalid command.");
                    break;
                }
                PrintHead();
            }
        }
 public ResidentViewModel()
 {
     ResidentHandler                 = new Handler.ResidentHandler(this);
     ResidentCatalogSingleton        = ResidentCatalogSingleton.Instance;
     ResidentHistoryCatalogSingleton = ResidentHistoryCatalogSingleton.Instance;
     LogInHandler            = new LogInHandler(this);
     NewResident             = new Resident();
     SelectedResident        = ResidentCatalogSingleton.SelectedResident;
     AccountCatalogSingleton = AccountCatalogSingleton.Instance;
     Account         = new Account();
     CurrentResident = ResidentCatalogSingleton.CurrentResident;
     CreateCommand   = new RelayCommand(ResidentHandler.CreateResident);
     DeleteCommand   = new RelayCommand(ResidentHandler.DeleteResident);
     UpdateCommand   = new RelayCommand(ResidentHandler.UpdateResident);
     LogInCommand    = new RelayCommand(LogInHandler.CheckAccount);
     AttachCommand   = new RelayCommand(ResidentHandler.AttachResident);
 }
Exemple #5
0
 protected void LogIn_Click(object sender, EventArgs e)
 {
     if (txtboxLogInEmail.Text != null && txtboxLogInPassword != null)
     {
         Customer user = LogInHandler.logIn(txtboxLogInEmail.Text, txtboxLogInPassword.Text);
         if (user != null)
         {
             Session["user"] = user;
             HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=\"\"JavaScript\"\">alert(\"Log in successful!\")</SCRIPT>");
         }
         else
         {
             HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=\"\"JavaScript\"\">alert(\"Log in failed due to incorrect credentials. Please try again.\")</SCRIPT>");
         }
     }
     else
     {
         HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=\"\"JavaScript\"\">alert(\"Both E-mail and Password should be filled in.\")</SCRIPT>");
     }
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of this class.
 /// </summary>
 /// <param name="endPoint">The IPEndpoint to expose the service to clients.</param>
 /// <exception cref="ArgumentException"></exception>
 /// <exception cref="ArgumentNullException"></exception>
 public LoginService(IPEndPoint endPoint) : base(endPoint)
 {
     dbLoginHandler = new LogInHandler();
     Logger.Log(new LogMessage("Login service started."));
 }