public async Task <IActionResult> Login(UILogin login) { if (ModelState.IsValid) { var(b, u) = repository.ValidateUserCredentials(login.UserName, login.Password); if (b) { var properties = new AuthenticationProperties { IsPersistent = login.RememberMe, }; var role = repository.GetUserRoles(u.Id); var claims = new List <Claim>() { new Claim(ClaimTypes.NameIdentifier, u.Id.ToString()), new Claim(ClaimTypes.Name, u.UserName), }; role.ForEach(x => claims.Add(new Claim(ClaimTypes.Role, x.RoleName))); var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); var principial = new ClaimsPrincipal(identity); await HttpContext.SignInAsync(principial, properties); return(RedirectToAction("Index", "UserHome")); } ModelState.AddModelError("", "Istifadeci adi ve ya parol sehhvdir"); return(View()); } return(RedirectToAction("Login")); }
// public string login { set => throw new NotImplementedException(); } #endregion #region <<METODOS>> public frmLogin(string subsistema) { this.Text = "LOGIN"; _Subsistema = subsistema; InitializeComponent(); _oLogin = new UILogin(this); }
public UIMgr() { uiList = new Dictionary <string, UIBase>(); outTouchList = new List <UIBase>(); removeList = new List <UIBase>(); recordList = new List <UIBase>(); uiSorterMgr = new UISorterMgr(1, 8000); InitRegisterHandler(); HUDTopBoardRoot = new GameObject("HUDTopBoardRoot"); HUDTopBoardRoot.transform.SetParent(GUIHelper.GetUIRootObj().transform, false); HUDTopBoardRoot.layer = LayerMask.NameToLayer("UI"); var canvas = HUDTopBoardRoot.AddComponent <Canvas>(); canvas.overrideSorting = true; canvas.sortingOrder = GUIHelper.GetUIRoot().sortingOrder - 2; HUDTopBoradCache = new GameObject("HUDTopBoradCache"); GameObject.DontDestroyOnLoad(HUDTopBoradCache); HUDTopBoradCache.SetActive(false); /*---------------UI界面控制脚本添加-------------------*/ UIBase ui = new UILogin(100, UILevel.Level1); uiList.Add("UILogin", ui); ui = new UILoading(101, UILevel.Common); uiList.Add("UILoading", ui); }
void StartGameLogic() { InitLanguage(); Tables.TableReader.ReadTables(); UILogin.ShowAsyn(); DataRecordManager.Instance.InitDataRecord(); AdManager.InitAdManager(); }
void OnHierarchyChange() { var all = Resources.FindObjectsOfTypeAll(typeof(UILogin)); if (all.Where(obj => (obj.hideFlags & HideFlags.HideInHierarchy) != HideFlags.HideInHierarchy).Count() == 1) { UILogin = (UILogin)all[0]; } }
public void Uninitialize() { if (_ui != null) { _ui.Uninitialize(); _ui = null; } isInitialized = false; }
public async Task <IActionResult> Login(UILogin model) { if (!ModelState.IsValid) { return(View(model)); } AppUserResponse result = new AppUserResponse(); using (var httpClient = new HttpClient()) { StringContent content = new StringContent( JsonConvert.SerializeObject(new Login { Email = model.Email, Password = model.Password }), System.Text.Encoding.UTF8, "application/json" ); using (var response = await httpClient.PostAsync(ServiceURL.GetURL(Config) + "Home/Login", content)) { string apiResponse = await response.Content.ReadAsStringAsync(); result = JsonConvert.DeserializeObject <AppUserResponse>(apiResponse); } } if (!result.Success || result.User == null) { ModelState.AddModelError("", result.Message); return(View(model)); } var prop = new AuthenticationProperties() { IsPersistent = model.RebemberMe, }; var claims = new List <Claim>(); claims.Add(new Claim(ClaimTypes.NameIdentifier, result.User.Id.ToString())); claims.Add(new Claim(ClaimTypes.Name, result.User.Email)); claims.Add(new Claim("Token", result.Token)); if (result.UserClaims != null) { result.UserClaims.ForEach(c => claims.Add(new Claim(ClaimTypes.Role, c.Value))); } var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); var principial = new ClaimsPrincipal(identity); await HttpContext.SignInAsync(principial, prop); return(RedirectToAction("Index")); }
/** * Functions to switch between UserControls */ public void switchToLogin() { UILogin = new UILogin(); VMLogin = new VMLogin(this, UILogin); //remove whatever control is currently in the Panel UIMainForm.getPnUserControl().Controls.Clear(); //add the other control, the HomePage control instead now UIMainForm.getPnUserControl().Controls.Add(UILogin); }
public bool Load() { _view = GameObject.Find("Canvas").GetComponent <UILogin> (); _view.touristBtn.onClick.RemoveAllListeners(); _view.touristBtn.onClick.AddListener(delegate() { UIOperation.Instance.OnClickTouristLogin(this); }); _view.weChatBtn.onClick.AddListener(delegate() { UIOperation.Instance.OnClickWechatLogin(this); }); loadImgSprite(); return(true); }
static public UILogin GetInstance() { UILogin self = UIManager.Singleton.GetUIWithoutLoad <UILogin>(); if (self != null) { return(self); } self = UIManager.Singleton.LoadUI <UILogin>("UI/UILogin", UIManager.Anchor.Center); return(self); }
void Awake() { _instance = this; accountContent.text = Localization.instance.Get("IDS_MESSAGE_LOGIN_INPUTACCOUNT"); passwordContent.text = Localization.instance.Get("IDS_MESSAGE_LOGIN_PASSWORD"); UIEventListener.Get(loginButton.gameObject).onClick = Login; UIEventListener.Get(backButton.gameObject).onClick = OnClosePanel; UIEventListener.Get(closeButton.gameObject).onClick = OnClosePanel; }
public GameObject settingsPanel; //The panel for the options menu. #endif #endregion _iMMOSETTINGS #endregion Variables #region Functions // Grabs our hidden components controls. private void Start() { network = GameObject.Find("NetworkManager").GetComponent <NetworkManagerMMO>(); popup = GameObject.Find("Popup").GetComponent <UIPopup>(); loginUI = GameObject.Find("Login").GetComponent <UILogin>(); mainMenuPanel = transform.GetChild(0).gameObject; #if _iMMOSETTINGS settingsButton = transform.GetChild(0).transform.GetChild(0).transform.GetChild(1).transform.GetChild(0).gameObject.GetComponent <Button>(); settingsPanel = GameObject.Find("UCE_UI_Settings"); #endif }
public UIMgr() { uiList = new Dictionary <string, UIBase>(); outTouchList = new List <UIBase>(); removeList = new List <UIBase>(); recordList = new List <UIBase>(); InitRegisterHandler(); /*---------------UI界面控制脚本添加-------------------*/ UIBase ui = new UILogin(100, UILevel.Common); uiList.Add("UILogin", ui); }
void Awake() { _instance = this; if (PlayerPrefs.HasKey(KEY_USERNAME)) { nameLabel.text = PlayerPrefs.GetString(KEY_USERNAME); } if (PlayerPrefs.HasKey(KEY_CLASS)) { classList.selection = PlayerPrefs.GetString(KEY_CLASS); } }
public void Initialize() { if (_ui == null) { _ui = new UILogin(); } DynamicStringManager.Instance.Init(); goUI = GameSystem.Instance.mClient.mUIManager.CreateUI("Prefab/GUI/UILogin"); _ui.Initialize(goUI); UIEventListener.Get(_ui.ButtonOK.gameObject).onClick = onOKClick; UIEventListener.Get(_ui.ButtonNotice.gameObject).onClick = showAnnounce; UIEventListener.Get(_ui.ButtonSwitch.gameObject).onClick = OnSwitch; UIEventListener.Get(_ui.ButtonCancle.gameObject).onClick = OnCancle; //_ui.ButtonOK.GetComponent<UIButton>().enabled = false; //NGUITools.SetActive(_ui.ButtonOK.gameObject, false); //区分第一二次登录 显示不同界面 InitLoginUI(); _ui.lblVersion.text = string.Format(_ui.lblVersion.text, GlobalConst.GAME_VERSION); thread1 = new Thread(GameSystem.Instance.ParseCommonConfig); thread2 = new Thread(GameSystem.Instance.ParseConfig); Scheduler.Instance.AddUpdator(Update); _time = 1.0f; if (!MainPlayer.Instance.CanSwitchAccount) { // _ui.lbSwitch.gameObject.SetActive(false); } isInitialized = true; GameSystem.Instance.mClient.bStartGuide = true; #if ANDROID_SDK || IOS_SDK #else _ui.InputAccount.onSubmit.Add(new EventDelegate(OnSubmitNum)); _ui.BtnInputOk.onClick.Add(new EventDelegate(OnNameInputOK)); #endif #if ANDROID_SDK if (Application.platform == RuntimePlatform.Android) { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity"); jo.Call("Login"); } #endif }
public ActionResult Login1(UILogin login) { string userName = login.UserName; string password = login.Password; if (userName == "Praveen" && password == "Test12$") { return(Redirect("/Employee/DatatableDemo")); } else { return(Redirect("/Login?status=InvalidUser")); } }
public override void OnInit() { base.OnInit(); AddPropChangedNotify((int)MVCPropertyID.enLogin, OnPropertyChanged); m_gameStart = FindChild("GameStart"); m_login = UILogin.GetInstance(); m_regist = UIRegist.GetInstance(); m_login.SetParent(WindowRoot); m_regist.SetParent(WindowRoot); m_login.HideWindow(); m_regist.HideWindow(); }
void OnEnable() { aUimage = Resources.Load("ADDonU", typeof(Texture2D)) as Texture2D; var all = Resources.FindObjectsOfTypeAll(typeof(UILogin)); if (all.Where(obj => (obj.hideFlags & HideFlags.HideInHierarchy) != HideFlags.HideInHierarchy).Count() == 1) { UILogin = (UILogin)all[0]; auXtraUiNormalColor = UILogin.auXtraUiLoginNormalColor; auXtraUiHighlightedColor = UILogin.auXtraUiLoginHighlightedColor; auXtraUiPressedColor = UILogin.auXtraUiLoginPressedColor; auXtraUiBackgroundColor = UILogin.auXtraUiLoginBackgroundColor; } }
private void Awake() { _instance = this; username = transform.Find("UIBG/LoginBG/AccountTxt/InputAccount/Text").GetComponent <Text>(); password = transform.Find("UIBG/LoginBG/PassWordTxt /InputAccount").GetComponent <InputField>(); LoginBtn = transform.Find("UIBG/LoginBG/LoginBtn").GetComponent <Button>(); LoginBtn.onClick.AddListener(() => { if (username.text != "") { PlayerSelect._instance.Login(); } else { SceneManager.LoadSceneAsync(ConstDates.MainSceneIndex); } }); }
public async Task <HttpResponseMessage> Login([FromBody] UILogin model) { Users foundUser = await _db.Users.Where(x => x.Username == model.Username).FirstOrDefaultAsync(); if (foundUser == null) { return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Not authorized!")); } string hash = PasswordHelper.GenerateHash(foundUser.PasswordSalt, model.Password); if (foundUser.PasswordHash != hash) { return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Not authorized!")); } //deactivate previous tokens foreach (var item in _db.AuthenticationTokens.Where(x => x.UserID == foundUser.UserID).ToList()) { item.IsDeleted = true; } _db.SaveChanges(); AuthenticationTokens newToken = new AuthenticationTokens { DeviceID = model.DeviceID, IsDeleted = false, UserID = foundUser.UserID, TokenDate = DateTime.Now, Token = Guid.NewGuid().ToString() }; _db.AuthenticationTokens.Add(newToken); _db.SaveChanges(); LoginResultDTO loginResult = new LoginResultDTO { token = newToken, user = foundUser }; return(Request.CreateResponse(HttpStatusCode.OK, loginResult)); }
void OnGUI() { var centeredStyle = GUI.skin.GetStyle("Label"); centeredStyle.alignment = TextAnchor.UpperCenter; GUILayout.Label(aUimage, centeredStyle); updateLive = EditorGUILayout.Toggle("Update Live", updateLive); // GUILayout.Label ("Base UI Color Settings", EditorStyles.boldLabel); // myString = EditorGUILayout.TextField ("Text Field", myString); auXtraUiEditAll = EditorGUILayout.BeginToggleGroup("XtraUI Login Panel", auXtraUiEditAll); UILogin = EditorGUILayout.ObjectField("UILogin GameObject", UILogin, typeof(UILogin)) as UILogin; auXtraUiNormalColor = EditorGUILayout.ColorField("UI Normal Color", auXtraUiNormalColor); auXtraUiHighlightedColor = EditorGUILayout.ColorField("UI Highlighted Color", auXtraUiHighlightedColor); auXtraUiPressedColor = EditorGUILayout.ColorField("UI Pressed Color", auXtraUiPressedColor); auXtraUiBackgroundColor = EditorGUILayout.ColorField("UI Background Color", auXtraUiBackgroundColor); // myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3); if (GUILayout.Button("Apply Change")) { UILogin.setBaseColors(auXtraUiNormalColor, auXtraUiHighlightedColor, auXtraUiPressedColor, auXtraUiBackgroundColor); EditorUtility.SetDirty(UILogin); SceneView.RepaintAll(); } EditorGUILayout.EndToggleGroup(); if (updateLive) { UILogin.setBaseColors(auXtraUiNormalColor, auXtraUiHighlightedColor, auXtraUiPressedColor, auXtraUiBackgroundColor); EditorUtility.SetDirty(UILogin); SceneView.RepaintAll(); } this.Repaint(); }
public void GetServerBack(string receive) { JObject jons = JObject.Parse(receive); string comm = (string)jons[nameof(Comm)]; if (comm != null && comm == (int)Comm.error + "") { ErrorType error = (ErrorType)(int)jons[nameof(ErrorType)]; string info = ""; switch (error) { case ErrorType.userIDShort: info = "用户名长度小于6位或大于10位"; break; case ErrorType.passwordShort: info = "密码长度小于6位或大于10位"; break; case ErrorType.format: info = "格式错误"; break; case ErrorType.userIDExist: info = "此账号已存在"; break; } UIManager.instance.ShowAlertTip(info); } else { UIManager.instance.ShowAlertTip("注册成功!"); UILogin.Show(); Close(); } }
public void OnClickLogin() { UILogin.Show(); Close(); }
public void OnClickBackLogin() { Close(); UILogin.Show(); }
// Use this for initialization void Start() { authUI = GetComponent <UILogin>(); InitializeFirebase(); }
//void Awake() //{ // UIComponent netWorkCOM = gameObject.GetComponent<UIComponent>(); // netWorkCOM.setCallback(NetResponse, OnEnterkkk, OnExitkkk); // //添加按钮回调 // UIEventListener.Get(netWorkCOM.objMap[LOGINBTN0]).onClick += preFireBnt; // UIEventListener.Get(netWorkCOM.objMap[LOGINBTN1]).onClick += preFireBnt; // UIEventListener.Get(netWorkCOM.objMap[LOGINBTN2]).onClick += preFireBnt; //} //// Use this for initialization //void Start() //{ //} //加入场景 replace=true 替换上一层。replace=false 直接叠加一层。 public static UILogin AddNew(bool replace = false) { UILogin s_UITongtiantaView = (UILogin)UILayerManage.getInstance().CreateAndAdd(new UILogin(), "UILogin", replace); return(s_UITongtiantaView); }
public void ClearUI() { UIPassword.Clear(); UILogin.Clear(); }
public VMLogin(VMMain VMMain, UILogin View) { this.View = View; this.View.ViewModel = this; this.VMMain = VMMain; }
private void Awake() { instance = this; // SocketManager.ListenDelegate(true, messageHandle, OperationListenInfo); }
/// <summary> /// Opens the login U. /// </summary> /// <returns><c>true</c>, if login U was opened, <c>false</c> otherwise.</returns> protected bool OpenLoginUI() { // create login ui resource if (!LoginUI) LoginUI = UISystem.GetSingleton().LoadWidget<UILogin>(ResourceDef.UI_LOGIN); // query system config info SqlSystem sqlSystem = GameSqlLite.GetSingleton().Query<SqlSystem>(0); if (!string.IsNullOrEmpty(sqlSystem.UserName) && !string.IsNullOrEmpty(sqlSystem.Password)) { LoginUI.SetUserName(sqlSystem.UserName); LoginUI.SetPassword(sqlSystem.Password); } return true; }
public void Update() { if (serverEventTCP.Count > 0) { MessageXieYi xieyi = serverEventTCP.Dequeue(); if (xieyi == null) { Debug.LogError("有事件操作的协议为空?"); return; } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.login) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { ErrorShow(error); } else { SocketManager.instance.GetBeatTime(); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.getHeartBeatTime) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { SocketManager.instance.OpenHeartbeat(); // UILogin.Close(); HomeUI.Show(); // Debug.Log("自身检查是否需要重连。"); SocketManager.instance.SendSave((byte)MessageConvention.reConnectCheck, new byte[] { }, false); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.reConnectCheck) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { ReconnctInfo rcInfo = SerializeHelper.Deserialize <ReconnctInfo>(xieyi.MessageContent); if (rcInfo.isReconnect) { CurrentPlayType = FramePlayType.断线重连; ReConnectUI.Show(); } else { CurrentPlayType = FramePlayType.游戏未开始; } } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.quitRoom)//自己退出房间 { QuitInfo qInfo = SerializeHelper.Deserialize <QuitInfo>(xieyi.MessageContent); if (qInfo.isQuit) { UpdateMemberHide(); RoomUI.Close(); HomeUI.Show(); if (qInfo.userIndex != DataController.instance.MyLocateIndex) { UIManager.instance.ShowAlertTip("您被踢出房间。"); } } else { if (qInfo.userIndex == qInfo.quitUnique) { UIManager.instance.ShowAlertTip("退出房间失败。"); } } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.updateActorState) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { CheckState(xieyi); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.updateModelInfo) { GameModelData modelDate = SerializeHelper.Deserialize <GameModelData>(xieyi.MessageContent); SetPrepareData(modelDate); } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.getPreGameData) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { Debug.Log("验证本客户端收到游戏前准备数据。客户端响应已收到:" + xieyi.MessageContentLength); SendState(RoomActorState.WaitForStart); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.startGaming) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { StartGaming(); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.endGaming) { ErrorType error = ClassGroup.CheckIsError(xieyi); if (error != ErrorType.none) { Debug.LogError(error); } else { EndGaming(xieyi); } } if ((MessageConvention)xieyi.XieYiFirstFlag == MessageConvention.frameData) { Debug.LogError("TCP收到整串操作数据"); UDPManager.instance.DealFrameData(xieyi); if (CurrentPlayType == FramePlayType.断线重连) { CurrentPlayType = FramePlayType.游戏中; } if (CurrentPlayType == FramePlayType.主动请求数据) { CurrentPlayType = FramePlayType.游戏中; } } } //UDP if (serverEventUDP.Count > 0) { MessageXieYi xieyi = serverEventUDP.Dequeue(); if (xieyi == null) { Debug.LogError("有UDP事件操作的协议为空?"); return; } if (xieyi.XieYiFirstFlag == (byte)MessageConvention.setUDP) { UDPManager.instance.IsConnect = true; Debug.LogError("用tcp 设置房间 udp"); //SocketManager.instance.SendSave((byte)MessageConvention.setUDP, xieyi.MessageContent, false); } } }
/// <summary> /// Active this instance. /// </summary> public override void Active() { // create login ui resource if (!LoginUI) LoginUI = UISystem.GetSingleton().LoadWidget<UILogin>(ResourceDef.UI_LOGIN); }