protected override void OnPressButton(bool?pressValue, DialogRegister data) { if (pressValue == true) { string name = userName.value; string pass = password.value; string rePass = rePassword.value; if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(pass) || string.IsNullOrEmpty(rePass)) { PuMain.Setting.Threading.QueueOnMainThread(() => { DialogService.Instance.ShowDialog(new DialogMessage("Lỗi", "Không được để trống các trường", null)); }); return; } if (pass.Equals(rePass)) { LoadingView.Instance.Show(); APILogin.QuickRegister(name, pass, QuickRegisterCallBack); } else { DialogService.Instance.ShowDialog(new DialogMessage("Lỗi", "Mật khẩu không giống nhau", null)); } } base.OnPressButton(pressValue, data); }
public HttpResponseMessage Login([FromBody] APILogin json) { if (!UserDataAccess.ValidateUser(json.e, json.hp)) { return new HttpResponseMessage { StatusCode = HttpStatusCode.Unauthorized } } ; var user = UserDataAccess.GetByName(json.e); if (user == null) { return new HttpResponseMessage { StatusCode = HttpStatusCode.Unauthorized } } ; var auth = new Authentication(); var hash = auth.LogIn(user); UserDataAccess.LogUserTransaction(user.IUserId, DateTime.Now); return(new HttpResponseMessage { Content = new StringContent(hash), StatusCode = HttpStatusCode.OK }); }
public override void LoadContent() { // API for login to the server _api = new APILogin(User); // Background _overlayLogin = new Sprite((_loginConnBg = Content.Load <Texture2D>("ui/connBg")), SpriteBatch); // Font background _overlayContent = new Sprite((_loginConnContentBg = Content.Load <Texture2D>("ui/connContentBg")), SpriteBatch); // Font for connection text _connText = new Font((_connTextFont = Content.Load <SpriteFont>("fonts/goldfish_font")), SpriteBatch); _connText.Color = new Color(111, 118, 130); _connText.UpperCase = false; // Text to calculate bounds _connText.Text = "Connecting..."; // Counters to safe time _counter = new Counter() { EndTime = 1 }; // This make sure has updated at least once! _safeTime = new Counter() { EndTime = 1500 }; Adjust(); }
public void LoginTrail() { LoadingView.Instance.Show(); APILogin.LoginTrial((bool status, string message) => { LoadingView.Instance.Show(false); if (status == false) { ShowDialogErrorInMainThread(message); } }); }
public IActionResult Login([FromBody] APILogin data) { var account = _icustomerAcount.GetCustomerAccountByUsenAndPas(data.Username, data.Password); int pass; if (!account.Any()) { pass = 1; return(Ok(1)); } else { pass = 2; return(Ok(account)); } }
public NewApiSelectPage() { exchanges = new List <ExchangeEntity>(); foreach (var x in StaticData.supportedExchanges) { exchanges.Add(x.Value); } InitializeComponent(); apilogin = new APILogin { exchange = Exchanges.Wallet, API_KEY = "", API_KEY_SECRET = "", }; BindingContext = this; }
public NewApiDataEntry(ExchangeEntity exchange) { this.exchange = exchange; InitializeComponent(); apilogin = new APILogin { exchange = this.exchange.exchange, API_KEY = "", API_KEY_SECRET = "", API_KEY_PASSWORD = "" }; this.help.Clicked += delegate { Device.OpenUri(new Uri("http://alloutcoin.com")); }; BindingContext = this; }
void OnClickForgotPass(bool?arg1, string arg2) { if (arg1 == true) { if (string.IsNullOrEmpty(arg2)) { view.ShowError("Không được để trống email"); return; } else { bool isEmail = Regex.IsMatch(arg2, REGEX_EMAIL); if (isEmail) { APILogin.RequestChangePassword(arg2, ForgotPassWordCallBack); } else { view.ShowError("Email không đúng định dạng"); } } } }
public void LoginWithAccessToken(string accessToken) { APILogin.Login(accessToken, LoginCallBack); }
public void GetAccessTokenWithSocial(string accessToken) { LoadingView.Instance.Show(); APILogin.GetAccessTokenFacebook(accessToken, OnGetAccessTokenWithFacebookCallBack); }
public void LoginWithUserName(string username, string password) { LoadingView.Instance.Show(); APILogin.GetAccessToken(username, password, GetAccessTokenCallBack); }
public ActionResult UserLogIn([FromBody] APILogin logInUser) { APIJsonResult result = new APIJsonResult(); APILoginView _aPILoginView = new APILoginView(); result.data = _aPILoginView; result.Access = true; result.success = false; var currentUserToken = User.Claims.SingleOrDefault(x => x.Type == "UserId") != null?User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null; var UserRole = User.Claims.SingleOrDefault(x => x.Type == "UserRole") != null?User.Claims.SingleOrDefault(x => x.Type == "UserRole").Value : null; //if (currentUserToken == null) //{ // result.Msg.Add(_localizer.GetString("web.Session Time Out")); // result.success = false; // return Ok(result); //} //int fildLogIn = Convert.ToInt32(_context.SystemSettings.Where(x => x.Name == "FildLogInNumber").FirstOrDefault().Value); if (User == null) { result.success = false; result.Msg.Add(_localizer.GetString("All fields must be filled")); return(Ok(result)); } else if (string.IsNullOrEmpty(logInUser.Email) || string.IsNullOrEmpty(logInUser.Password)) { result.success = false; result.Msg.Add(_localizer.GetString("All fields must be filled")); return(Ok(result)); } using (var algorithm = MD5.Create()) //or MD5 SHA256 etc. { var hashedBytes = algorithm.ComputeHash(Encoding.UTF8.GetBytes(logInUser.Password)); logInUser.Password = BitConverter.ToString(hashedBytes).Replace("-", "").ToLower(); } var user = _context.Users.Where(x => x.Email == logInUser.Email && x.IsDeleted != true && x.Password == logInUser.Password).Include(f => f.fk_UserRoleMap).ThenInclude(g => g.UserRole).ThenInclude(p => p.fk_UserRolePermMap).ThenInclude(h => h.Permission).FirstOrDefault(); if (user == null) { result.success = false; result.Msg.Add(_localizer.GetString("InCorrect Credential")); //result.Msg.Add(_localizer.GetString("Email") + logInUser.Email); //result.Msg.Add(_localizer.GetString("Password") + logInUser.Password); return(Ok(result)); } //if (user.FildLogIn == fildLogIn) //{ // user.Activation = false; // _context.Update(user); // _context.SaveChanges(); // result.Msg.Add("Admin.YourAccountHasBeenBlocked"); // return Ok(result); //} if (user.Password == logInUser.Password) { user.FildLogIn = 0; if (user.JwtToken != null) { user.JwtToken = result.token = Token.GenerateToken(user.Id.ToString(), user.fk_UserRoleMap[0].UserRole.Name); user.UdateDateFCMToken = DateTime.Now; } else { user.JwtToken = result.token = Token.GenerateToken(user.Id.ToString(), user.fk_UserRoleMap[0].UserRole.Name); user.CreateDateJwtToken = DateTime.Now; } if (currentUserToken != null) { var gustUser = _gustUserDevice.Where(x => x.DeviceId == currentUserToken).FirstOrDefault(); if (gustUser != null) { _gustUserDevice.Remove(gustUser); } } _context.Update(user); _context.SaveChanges(); } else { user.FildLogIn = user.FildLogIn == null ? 1 : user.FildLogIn + 1; // User Type _context.Update(user); _context.SaveChanges(); result.Msg.Add(_localizer.GetString("Admin.Your Password Incorrect Number of attempts to log in -") + (user.FildLogIn) + " -"); return(Ok(result)); } result.success = true; UserProfile userData = new UserProfile() { Id = user.Id, Email = user.Email, Name = user.Name, Mobile = user.Mobile, UserType = user.fk_UserRoleMap[0].UserRole.Name }; result.data = userData; result.Msg.Add(_localizer.GetString("Admin.Successfully logged In")); return(Ok(result)); }