public AuthView Login(string username, string password) { bool verified = VerifyHashedPassword(password, username); DateTime dateTime = DateTime.Now; try { if (verified) { Guid g = Guid.NewGuid(); string AuthKey = Convert.ToBase64String(g.ToByteArray()); AuthKey = AuthKey.Replace("=", ""); AuthKey = AuthKey.Replace("+", ""); AuthKey = AuthKey.Replace("/", ""); AuthView view = new AuthView(); if (iDatabaseAccount.Login(username, dateTime, AuthKey)) { view.Name = username; view.Key = AuthKey; //view.Roles = iDatabaseAccount.GetRoles(username); return(view); } else { throw new OperationCanceledException("Username or Password is invalid"); } } } catch (Exception) { throw; } throw new OperationCanceledException("Username or Password is invalid"); }
public void Login() { AuthView view = new AuthView(); view = auth.Login("Groep2", "groep2"); Assert.AreEqual("Groep2", view.Name); }
public void Back() { AuthView t = new AuthView(); t.Show(); Close(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.AuthActivity); DroidDAL.HockeyAppRegister(this); _view = FindViewById <AuthView>(Resource.Id.auth_view); InitStatusBar(); ThemeHolder.Init(DataService.RepositoryController.RepositoryThemes); _interactor = new InteractorAuth(new AuthController(ConnectionController.GetInstance(), WebMsgParser.ParseResponseAuth), new ValidationRA()); #if MOCK _presenter = new PresenterAuthMOCK(_view, _interactor, new RouterAuth(this), FacebookCallLoginAction, GoogleCallLoginAction, VkCallLoginAction, OkCallLoginAction, new AuthStylesHolderDroid <GlobalControlsTheme>(new ThemeParser <GlobalControlsTheme>()), DataService.RepositoryController.RepositoryRA.LangRA); #else _presenter = new PresenterAuth(_view, _interactor, new RouterAuth(this), FacebookCallLoginAction, GoogleCallLoginAction, VkCallLoginAction, OkCallLoginAction, new AuthStylesHolderDroid <GlobalControlsTheme>(new ThemeParser <GlobalControlsTheme>()), DataService.RepositoryController.RepositoryRA.LangRA); #endif _presenter.SetConfig(); _callbackManager = CallbackManagerFactory.Create(); _facebookCallback = new FacebookCallback(_interactor); LoginManager.Instance.RegisterCallback(_callbackManager, _facebookCallback); _interactor.OnSocialLogOut += SocialLogOut; }
public AdapterPresentation(AuthView currentState, AdfsConfig adfsConfig, string param) { viewId = currentState; this.adfsConfig = adfsConfig; this.param = param; rspDto = null; }
public AdapterPresentation(AuthView currentState, AdfsConfig adfsConfig) { viewId = currentState; this.adfsConfig = adfsConfig; param = null; rspDto = null; }
static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //HttpClient client = new HttpClient(); //HttpResponseMessage response = await client.GetAsync("http://localhost:8080/accounts/"); //response.EnsureSuccessStatusCode(); AuthView = new AuthView(); ConnectView = new ConnectView(); LoginView = new LoginView(); PlayView = new PlayView(); RegisterView = new RegisterView(); CreditBankMenurView = new CreditBankMenuView(); CreditBankAuthenticationVIew = new CreditBankAuthenticationVIew(); AuthController = new AuthController(); ConnectController = new ConnectController(); PlayController = new PlayController(); AuthController = new AuthController(); CreditBankController = new CreditBankController(); Application.Run(ConnectView); }
private void Logout() { AuthView _win = new AuthView(); _win.WindowStartupLocation = WindowStartupLocation.CenterScreen; _win.Show(); Close(); }
//public AdapterPresentation(AuthView currentState, AdfsConfig adfsConfig, ServiceStatus svcStatus, string svcDetail) //{ // viewId = currentState; // this.adfsConfig = adfsConfig; // rspStatus = svcStatus; // param = svcDetail; // rspDto = null; //} public AdapterPresentation(AuthView currentState, AdfsConfig adfsConfig, AuthResponseDto rspDto) { viewId = currentState; this.adfsConfig = adfsConfig; // rspStatus = rspDto.Status; this.rspDto = rspDto; param = (string)rspDto.Detail; }
public MainView() { InitializeComponent(); if (LoadUserData()) { return; } Content = new AuthView(GoToApp); }
public void Init() { kernel = new StandardKernel(new NinjectMappings()); _userProps = kernel.Get <UserProperties>(); _authView = kernel.Get <AuthView>(); this.Content = _authView; (_authView.DataContext as AuthViewModel).OnSuccessAuth += OnSuccessAuth; }
public void RegisterCommand() { try { ErrorMes = ""; flag = true; login += " "; int x1 = login.Length - 1; login = login.Substring(0, x1); bool fl = true; if (password.Length < 8) { ErrorMes = Properties.Resources.charac; } if (password == String.Empty || password == null || lastname == String.Empty || lastname == null || gender == null || gender == String.Empty || purpose_of_use == String.Empty || purpose_of_use == null || age == null || age == String.Empty || height == null || height == String.Empty || activity == String.Empty || activity == null || firstname == null || firstname == String.Empty) { fl = false; ErrorMes = Properties.Resources.emptyfield; } bool IsDone = true; if (fl && canreg) { DataBaseUser spam = new DataBaseUser(); string Pass = DB.DB.Hash(password).ToString(); IsDone = spam.AddUser(login, Pass, firstname, lastname, purpose_of_use, gender, age, height, weight, activity, daily_calories); if (IsDone) { AuthView t = new AuthView(); t.Show(); Close(); } } if (!IsDone) { ErrorMes = Properties.Resources.existserr; login = ""; } canreg = true; flag = false; } catch (SystemException) { ErrorMes = Properties.Resources.errordata; } }
public void Back() { AuthView t = new AuthView(); Close(); Thread myThread = new Thread(new ThreadStart(DB.DB.ShowLoader)); myThread.SetApartmentState(ApartmentState.STA); myThread.Start(); Thread.Sleep(1000); myThread.Abort(); t.WindowStartupLocation = WindowStartupLocation.CenterScreen; t.Show(); }
public void Changeacc() { if (MessageBox.Show($"Вы уверенны, что вы хотите выйти?", "Подтвердите", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { AuthView t = new AuthView(); Close(); Thread myThread = new Thread(new ThreadStart(DB.DB.ShowLoader)); myThread.SetApartmentState(ApartmentState.STA); myThread.Start(); Thread.Sleep(1000); myThread.Abort(); t.WindowStartupLocation = WindowStartupLocation.CenterScreen; t.Show(); } }
public void RegisterCommand() { using (MyDbContext db = new MyDbContext()) { bool Registration = true; ErrorMes = ""; try { SqlParameter param = new SqlParameter("@Login", Login); var users = db.Database.SqlQuery <User>("SELECT * FROM Users WHERE Login LIKE @Login", param); foreach (var user in users) { if (user.Login == Login) { Registration = false; } } if (Registration) { user = new User(); user.FirstName = FirstName; user.Surname = Surname; user.BDay = BDay; user.Gender = Gender; user.Login = Login; user.Password = Password; db.Users.Add(user); db.SaveChanges(); AuthView t = new AuthView(); t.Show(); Close(); } else { ErrorMes = "Такой логин уже существует"; Login = ""; } } catch (Exception ex) {} } }
public void Validate(string authenticationCookie) { if (UserExists(authenticationCookie)) { var auth = new AuthenticationMiddleware(); var user = _context.Users.FirstOrDefault(u => u.Login == authenticationCookie); Model = new AuthView(); ((AuthView)Model).Token = auth.GenerateToken(user); } else { ((AuthView)Model).Token = null; } }
public void Authorize(bool clearCookies) { _eventAggregator.GetEvent <AuthBarEvents.AuthorizeRequest>().Publish(); //var accessToken = App.Container.GetInstance<AccessToken>(); //var authWindow = new AuthView(accessToken, clearCookies); if (clearCookies) { VkAuthorization.ClearCookies(); } var authWindow = new AuthView();//App.Container.GetInstance<AuthView>(); authWindow.Action = AuthAction.Authorize; authWindow.ShowDialog(); //_regionManager.RequestNavigate(RegionNames.MainRegion, $"VkAuthorization?clearcookies={clearCookies}"); }
ActivePage active; //Активная страница #endregion /// <summary> /// Конструктор главной модели представлений /// </summary> public MainViewModel() { active = new ActivePage(); if (Properties.Settings.Default.First_Start) { Active = new RegView() { DataContext = new RegViewModel(active) } } ; else { Active = new AuthView() { DataContext = new AuthViewModel() } }; }
private bool LoadUserData() { // TODO: Loading Screen UpdateMacAddress(); ProcessData.LoadData(); AuthenticationUser.GetInstance().UpdateToken(); if (AuthenticationUser.GetInstance().IsDataValid()) { // Creating AuthView to initialize AuthModel _goToApp action AuthView authView = new AuthView(GoToApp, false); AuthModel.SignIn(); return(true); } return(false); }
//todo: деавторизация не работает! public void Deauthorize() { _eventAggregator.GetEvent <AuthBarEvents.LogOutRequest>().Publish(); IsAuthorized = false; UserName = string.Empty; SetUpAvatar(DEFAULT_AVATAR); _vkApi.Token.Set(new AccessToken()); var authWindow = new AuthView();//App.Container.GetInstance<AuthView>(); authWindow.Action = AuthAction.Deauthorize; authWindow.ShowDialog(); VkAuthorization.ClearAllCookies(); //App.SuppressWininetBehavior(); _eventAggregator.GetEvent <AuthBarEvents.LogOutCompleted>().Publish(); }
/// <summary> /// Инициализация данных контроллера. /// </summary> public override void Initialize() { _authModel = ClientCore.Instance.CreateInstance <AuthControlModel>(); _view = new AuthView { DataContext = _authModel }; _authModel.IsEnabaled = true; _authModel.RegisterAreaVisible = false; _view.cancelButton.Click += CancelButtonClick; _view.showRegisterButton.Click += ShowRegisterButtonClick; _view.registerButton.Click += RegisterButtonClick; _view.authButton.Click += AuthButtonClick; _view.passwordTextBox.KeyDown += PasswordTextBoxKeyDown; ReloadUsers(null); ClientCore.Instance.AuthService.InfoStatusChanged += AuthServiceInfoStatusChanged; ClientCore.Instance.AuthService.AuthError += AuthServiceAuthError; ClientCore.Instance.AuthService.UserRegistred += AuthServiceOnUserRegistred; ClientCore.Instance.AuthService.AuthComplited += AuthServiceOnAuthComplited; }
public IActionResult Login(LoginViewModel user) { try { AuthView auth = new AuthView(); Authentication authentication = new Authentication(); auth = authentication.Login(user.name, user.password); if (auth.Key != null || auth.Key != "") { HttpContext.Response.Cookies.Append("key", auth.Key); return(RedirectToAction("Index", "Depot")); } else { return(RedirectToAction("Index", "Home")); } } catch { return(RedirectToAction("Index", "Home")); } }
public ViewRegistry(ITextUI ui) { TextClient GetGame() => ui.Game; ui.RegisterMainView(Exception = new ExceptionView(), "exception"); ui.RegisterMainView(Auth = new AuthView(), "auth", "authentication", "login"); ui.RegisterMainView(Home = new HomeView(CommandContext.HOME.Set(), 60, 2, GetGame), "home"); ui.RegisterSideView(GameModes = new ListView(" # Game Modes", () => ui.Game.ActiveGameModes.Select(gm => ui.Game.Resources.GetMetadata(gm)).Where(gm => gm.PermissionLevel <= ui.Game.PermissionLevel).Select(gm => (FormattedString)gm.Name), CommandContext.HOME.Set(), 25), "modes", "gamemodes", "game modes"); ui.RegisterSideView(Settings = new SettingsView(GetGame), "settings", "options"); ui.RegisterSideView(Friends = new ListView(" # Friends", () => ui.Game.Friends.Values.Select(f => f.ToDisplay()), CommandContext.HOME.Set(), 22), "friends", "friendlist", "friend list"); ui.RegisterSideView(Notifications = new ListView(" # Notifications", () => ui.Game.PendingFriendRequests.Keys.Select(fr => (FormattedString)string.Format("FR {0}", fr)).Concat(ui.Game.PendingPartyInvitations.Keys.Select(pi => (FormattedString)string.Format("PI {0}", pi))), CommandContext.HOME.Set(), 23), "notifications"); ui.RegisterSideView(Party = new PartyView(CommandContext.HOME.Set().And(c => ui.Game.Party != null), GetGame), "party"); ui.RegisterMainView(Game = new GameView(CommandExtensions.IsInLobbyOrGame, 60, 20, GetGame), "game"); ui.RegisterSideView(Players = new ListView(" # Players", () => ui.Game.GameState.Players.Select(ps => (FormattedString)(ps.Dead ? "" : ui.Game.GameState.ToName(ps.ID, true))), CommandExtensions.IsInLobbyOrGame, 25), "players", "playerlist", "player list"); ui.RegisterSideView(Roles = new ListView(" # Roles", () => ui.Game.GameState.Roles.Select(r => ui.Game.Resources.Of(r)), CommandExtensions.IsInLobbyOrGame, 25), "roles", "rolelist", "role list"); ui.RegisterSideView(Graveyard = new ListView(" # Graveyard", () => ui.Game.GameState.Graveyard.Select(ps => ui.Game.GameState.ToName(ps, true)), CommandExtensions.IsInGame, 40), "graveyard", "deaths"); ui.RegisterSideView(Team = new ListView(" # Team", () => ui.Game.GameState.Team.Select(ps => !ps.Dead || ps.Role == Role.DISGUISER ? ui.Game.GameState.ToName(ps, true) : ""), CommandExtensions.IsInGame, 40), "team", "teammates"); ui.RegisterSideView(LastWill = new WillView(CommandExtensions.IsInGame), "lw", "dn", "lastwill", "deathnote", "last will", "death note"); ui.RegisterSideView(Winners = new ListView(" # Winners", () => ui.Game.GameState.Winners.Select(p => (FormattedString)ui.Game.GameState.ToName(p, true)), CommandContext.GAME_END.Set(), 25), "winners", "winnerlist", "winner list"); ui.RegisterSideView(MyLastWill = new EditableWillView(CommandExtensions.IsInGame), "mlw", "mylastwill", "my lastwill", "my last will"); ui.RegisterSideView(MyDeathNote = new EditableWillView(context => CommandExtensions.IsInGame(context) && ui.Game.GameState.Role.HasDeathNote()), "mdn", "mydeathnote", "my deathnote", "my death note"); ui.RegisterSideView(MyForgedWill = new EditableWillView(context => CommandExtensions.IsInGame(context) && ui.Game.GameState.Role == Role.FORGER), "mfw", "myforgedwill", "my forgedwill", "my forged will"); ui.RegisterSideView(Help = new HelpView(ui.Commands, () => ui.CommandContext, 40, 1), "?", "h", "help"); }
public void GoToAuth() { Content = new AuthView(GoToApp); }
protected override void OnStartup(StartupEventArgs e) { var view = new AuthView().ShowDialog(); base.OnStartup(e); }