Пример #1
0
 public override void InitSys()
 {
     base.InitSys();
     Debug.Log(GetType() + "InitLogin()");
     Instance = this;
     EnterLogin();
 }
Пример #2
0
    public override void InitSys()
    {
        base.InitSys();

        Instance = this;
        PECommon.Log("Init LoginSys...");
    }
Пример #3
0
        private static void TestCollection()
        {
            Console.WriteLine("Start to testing with generic collection");
            SortedList <string, string> sortedListString = new SortedList <string, string>()
            {
                { "hello", "hi" },
                { "hello1", "hi1" },
                { "hello2", "hi2" }
            };

            Console.WriteLine(sortedListString.GetValueOrDefault("hello"));

            //Concurrent
            ISysLogin sys = new LoginSystem();
            int       i   = 0;

            ConcurrentBag <bool> results = new ConcurrentBag <bool>();
            ParallelLoopResult   loopPar = Parallel.For(0, 100000, (j) => {
                results.Add(sys.Register("Username" + i, "Password"));
                i++;
            });

            while (!loopPar.IsCompleted)
            {
            }
            Console.WriteLine("Number of Success process: {0}", results.Count(a => a));
            Console.WriteLine("Number of failed process: {0}", results.Count(a => !a));
            Console.WriteLine("Number of process: {0}", results.Count);
        }
Пример #4
0
        public ActionResult Registration(LoginSystem.Models.UserModel user)
        {
            if (ModelState.IsValid)
                {
                    var db = new MainDbEntities();
                    try
                    {
                        var crypto = new SimpleCrypto.PBKDF2();
                        var encrpPass = crypto.Compute(user.Password);
                        var sysUser = db.SystemUsers.Create();

                        sysUser.Email = user.Email;
                        sysUser.Password = encrpPass;
                        sysUser.PasswordSalt = crypto.Salt;
                        sysUser.UserId = "2";
                        db.Configuration.ValidateOnSaveEnabled = false;
                        db.SystemUsers.Add(sysUser);
                        db.SaveChanges();

                        return RedirectToAction("Index", "Home");

                    }

                    finally { }

                }
                else {
                    ModelState.AddModelError("","Log in data is incorrect");

                }

                return View(user);
        }
        public List <LoginSystem> LoginSystem()
        {
            List <LoginSystem> _loginSystem = new List <LoginSystem>();

            string _sQuery = "SELECT * FROM LOGINSYSTEM";

            DataTable _dt = SelectData.Select.ExcuteQuery(_sQuery);

            foreach (DataRow _dr in _dt.Rows)
            {
                LoginSystem _ls = new LoginSystem();

                _ls.ID    = _dr["ID"].ToString();
                _ls.Pass  = _dr["PASS"].ToString();
                _ls.Email = _dr["EMAIL"].ToString();

                _loginSystem.Add(_ls);

                _ls = null;
            }

            _dt = null;

            return(_loginSystem);
        }
Пример #6
0
        public IActionResult ForgotPassword()
        {
            var loginSystem = new LoginSystem();

            loginSystem.Step = "forgot";
            return(View("GettingStarted", loginSystem));
        }
Пример #7
0
 // Start is called before the first frame update
 void Start()
 {
     lsScript = FindObjectOfType <LoginSystem>();
     slider   = GetComponentInChildren <Slider>();
     userID   = lsScript.user.user_ID;
     StartCoroutine(GetBool("https://testserversoubra.herokuapp.com/CheckArray/" + ID + "/" + userID));
 }
Пример #8
0
        public IActionResult ImportWallet()
        {
            var loginSystem = new LoginSystem();

            loginSystem.Step = "import";
            return(View("GettingStarted", loginSystem));
        }
Пример #9
0
        public IActionResult RecoverFromCertificate()
        {
            var loginSystem = new LoginSystem();

            loginSystem.Step = "recover";
            return(View("GettingStarted", loginSystem));
        }
Пример #10
0
    void Awake()
    {
        var AM = AssetDatabase.LoadAssetAtPath <GameObject> (AccountManagerPath);

        Manager       = AM.GetComponent <RegisterSystem> ();
        ManagerForget = AM.GetComponent <forgetPassword> ();
        ManagerLogin  = AM.GetComponent <LoginSystem> ();
        ManagerReset  = AM.GetComponent <ResetPassword> ();
        ManagerActive = AM.GetComponent <ActiveAccount> ();
    }
Пример #11
0
        public async Task <IActionResult> Login(LoginSystem loginSystem)
        {
            loginSystem.Step = "login";

            if (ModelState.IsValid)
            {
                var getUser = await _userManager.FindByEmailAsync(loginSystem.LoginModel.Mail);

                //ModelState.AddModelError("LoginModel.Mail", "This account does not exists.");

                try
                {
                    var fullyCryptedToken = await _vaultClient.V1.Secrets.KeyValue.V2.ReadSecretAsync($"safeblock/io/tokens/{SecurityUsing.Sha1(loginSystem.LoginModel.Mail)}");

                    var halfCryptedToken = Aes.Decrypt(loginSystem.LoginModel.Password, SecurityUsing.HexToBytes(fullyCryptedToken.Data.Data["token"].ToString()));
                    var token            = Aes.Decrypt(_globalSettings.Value.AesPassphrase, SecurityUsing.HexToBytes(halfCryptedToken));

                    if (getUser.Token.Equals(token))
                    {
                        var loginResult = await _signInManager.PasswordSignInAsync(getUser, token, loginSystem.LoginModel.KeepSession, true);

                        if (loginResult.Succeeded)
                        {
                            return(RedirectToAction("Index", "Dashboard"));
                        }
                        if (loginResult.RequiresTwoFactor)
                        {
                            //TODO: redirect to 2FA
                        }
                        if (loginResult.IsLockedOut)
                        {
                            //TODO: redirect to lockout
                        }
                        else
                        {
                            ModelState.AddModelError(string.Empty, "Invalid login attempt.");
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("LoginModel.Mail", "Invalid login attempt.");
                    }
                }
                catch (Exception e)
                {
                    getUser.AccessFailedCount++;
                    await _userManager.UpdateAsync(getUser);

                    ModelState.AddModelError("LoginModel.Mail", "Unable to decrypt your account.");
                }
            }
            return(View("GettingStarted", loginSystem));
        }
Пример #12
0
        static void Main(string[] args)
        {
            MainMenu main = new MainMenu();

            Console.ForegroundColor = ConsoleColor.DarkCyan;
            LoginSystem  loginSystem = new LoginSystem();
            HidePassword hide = new HidePassword();
            string       login, password = "";

            Console.WriteLine("\t\t\t\tPizzaHUB" + "\nChoose action:" + "\n1.Login" + "\n2.Register");

            int choose = 0;

            while (choose != 1 && choose != 2)
            {
                if (int.TryParse(Console.ReadLine(), out choose))
                {
                    switch (choose)
                    {
                    case 1:
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("\t\t\tLogin\nLogin:"******"Password:"******"Введите адекватное число!");
                }
                else
                {
                    Console.WriteLine("Введите адекватное число!");
                }
            }
            Console.ReadLine();
        }
Пример #13
0
        public ActionResult Enter(LoginSystem login)
        {
            ViewBag.Name = message;
            string        mainconn   = ConfigurationManager.ConnectionStrings["StudioConnection"].ConnectionString;
            SqlConnection connection = new SqlConnection(mainconn);
            string        sqlquery   = "SELECT UserId, Email, UserName, RoleID, Password from [dbo].[Users] where Email = @Email and Password = @Password";

            connection.Open();
            SqlCommand sqlCommand = new SqlCommand(sqlquery, connection);

            sqlCommand.Parameters.AddWithValue("@Email", login.Email);
            sqlCommand.Parameters.AddWithValue("@Password", login.Password);

            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            if (sqlDataReader.HasRows)
            {
                Session["email"] = login.Email.ToString();
                while (sqlDataReader.Read()) // построчно считываем данные
                {
                    login.Id = Convert.ToInt32(sqlDataReader["UserId"]);
                    string email = sqlDataReader.GetString(1);
                    string name  = sqlDataReader.GetString(2);
                    object role  = sqlDataReader.GetValue(3);

                    Session["name"]     = name;
                    Session["id"]       = login.Id;
                    Session["email"]    = email;
                    ViewData["Message"] = Convert.ToInt32(Session["id"]);
                    if (email == "*****@*****.**" || (int)role == 1 && (int)role == 3)
                    {
                        return(Redirect("/Administration/All_Services"));
                    }
                    break;
                }


                return(RedirectToAction("Logined"));
            }

            else
            {
                ViewBag.LoginFailed = "Login failed";
            }

            connection.Close();

            return(View());
        }
Пример #14
0
    void OnClickOk()
    {
        if (accountInput.text == "")
        {
            FastTips.Show("用户名不能为空!");
            return;
        }
        if (passwordInput.text == "")
        {
            FastTips.Show("密码不能为空!");
            return;
        }

        LoginSystem.LoginReq(accountInput.text, passwordInput.text);
        PlayerPrefs.SetString(AccountKey, accountInput.text);
    }
Пример #15
0
    public void Init()
    {
        //初始化资源服务
        ResService.Instance.InitRes();

        //初始化登录系统
        LoginSystem logSys = GetComponent <LoginSystem>();

        logSys.InitSys();

        //声音系统
        AudioService audioSvr = GetComponent <AudioService>();

        audioSvr.InitSvr();

        //
    }
Пример #16
0
    private void Start()
    {
        Debug.Log("游戏开始");

        DontDestroyOnLoad(this.gameObject);
        //对绑定在GR上的组件赋值
        resourceService  = ResourceService.Instance;
        m_LoginSystem    = LoginSystem.Instance;
        audioService     = AudioService.Instance;
        netService       = NetService.Instance;
        m_MainCitySystem = MainCitySystem.Instance;
        //初始化
        Init();
        //调试用, 清零UI
        ClearUI();
        //只显示Tips
        UIDynamicWindow.SetWindowState();
    }
Пример #17
0
        static void Main(string[] args)
        {
            LoginSystem ACGateLoginSystem = new LoginSystem();

            ACGateLoginSystem.MAP_PATH = @"D:\1.png";

            if (File.Exists(ACGateLoginSystem.MAP_PATH))
            {
                Console.WriteLine("File Exists");
            }

            if (File.Exists("D:\\1.png"))
            {
                Console.WriteLine("File Exists - with direct path");
            }

            Console.ReadLine();
        }
Пример #18
0
        public ActionResult LogIn(LoginSystem.Models.UserModel user)
        {
            if(ModelState.IsValid)
                {
                    if (isValid(user.Email, user.Password))
                    {

                        FormsAuthentication.SetAuthCookie(user.Email, false);
                        return RedirectToAction("Index", "Home");
                    }
                    else {
                        ModelState.AddModelError("","Log in Data is incorrect!");

                    }

                }

                return View(user);
        }
Пример #19
0
    private void Init()
    {
        //服务模块初始化
        //NetService net = GetComponent<NetService>();
        //net.InitSvc();
        ResourcesService res = GetComponent <ResourcesService>();

        res.InitSvc();
        AudioService audio = GetComponent <AudioService>();

        audio.InitSvc();
        TimerService timer = GetComponent <TimerService>();

        timer.InitSvc();
        //业务系统初始化
        LoginSystem login = GetComponent <LoginSystem>();

        login.InitSys();
        //进入登录场景并加载相应UI
        login.EnterLogin();
    }
Пример #20
0
    void Start()
    {
        instanse = this;

        isLogined = false;
        var login           = new InputField.SubmitEvent();
        var inputedPassword = new InputField.SubmitEvent();


        login.AddListener(SubmitName);
        inputedPassword.AddListener(SubmitPassword);
        InputerLogin.onEndEdit    = login;
        InputerPassword.onEndEdit = inputedPassword;
        if (!dissableOnStart)
        {
            if (isLogined == false && LoginPanel.activeSelf == false)
            {
                LoginPanel.SetActive(true);
            }
        }
    }
Пример #21
0
    void Init()
    {
        //按顺序初始化模块
        //服务模块
        NetService net = GetComponent <NetService>();

        net.InitNetService();
        ResService res = GetComponent <ResService>();

        res.InitRes();
        AudioService audio = GetComponent <AudioService>();

        audio.InitService();

        //业务系统初始化
        LoginSystem login = GetComponent <LoginSystem>();

        login.Init();

        //进入登录场景并加载相应UI
        login.EnterLogin();
    }
Пример #22
0
    private void Awake()
    {
        if (instance != this)
        {
            Destroy(gameObject);
            //게임이 끝나 다시 로비신으로 돌아왔을경우
            //isLogin은 true가 됨
            isLogin = true;
        }

        if (isLogin)
        {
            //isLogin이 true일때 로그인 부분을 스킵하고 바로 로비로 넘어가게함
            loginSystem = GameObject.Find("LoginPanel").GetComponent <LoginSystem>();
            loginSystem.StartCoroutine(loginSystem.GoCamera());
            loginSystem.MatchingBtn.SetActive(true);
            loginSystem.LoginPanel.SetActive(false);
        }
        //실행했는데 디렉토리에 json폴더가 없다면(최초실행시)
        if (!Directory.Exists(Application.persistentDataPath + "/Json/"))
        {
            //디렉토리에 폴더 생성해줌
            Directory.CreateDirectory(Application.persistentDataPath + "/Json/");
            Directory.CreateDirectory(Application.persistentDataPath + "/Json/Item/");
            Directory.CreateDirectory(Application.persistentDataPath + "/Json/InGameData/");
        }
        else
        {
            //json폴더가 있다면(재시작시) 승패기록을 초기화해줌
            if (isLogin)
            {
                return;
            }

            ClearJsonFolder("InGameData");
        }
        DontDestroyOnLoad(gameObject);
    }
Пример #23
0
    /// <summary>
    /// 初始化游戏
    /// </summary>
    private void Init()
    {
        ///服务模块 初始化;
        ResSever resSever = GetComponent <ResSever>();

        resSever.IniResSever();

        NetSvc net = GetComponent <NetSvc>();

        net.InitSvc();

        AudioSer audioSer = GetComponent <AudioSer>();

        audioSer.IniAudioSer();

        ///业务系统 初始化;
        LoginSystem loginSystem = GetComponent <LoginSystem>();

        loginSystem.IniSys();

        ///载入登陆场景:
        loginSystem.EnterLogin();
    }
Пример #24
0
 private void OnLoginSceneCompleted(string sceneName, float duration, object userData)
 {
     // 显示登录场景界面
     LoginSystem.GetInstance().ShowLoginPanel();
 }
Пример #25
0
 // Start is called before the first frame update
 void Start()
 {
     lsSystem = FindObjectOfType <LoginSystem>();
 }
        private void LoginForm_Load(object sender, EventArgs e)
        {
            sys = new LoginSystem();

            this.FormClosed += LoginForm_FormClosed;
        }
Пример #27
0
 /// <summary>
 /// Get the display string for an enum by it's value in enum form
 /// </summary>
 /// <param name="value">The enum value in enum form</param>
 /// <returns>The display string for the value or the default if one cannot be found</returns>
 public static string GetByEnum(LoginSystem value)
 {
     return(GetByEnum((int)value));
 }
Пример #28
0
 public override void Init()
 {
     base.Init();
     instance = this;
     PECommon.Log("LoginInit...");
 }
    private void Update()
    {
        //什么时候加载这个系统?
        //Drawing系统初始化 ================================
        if (characterSelectSystem == null)
        {
            characterSelectSystem = this.GetComponent <CharacterSelectSystem>();
        }
        if (loginSystem == null)
        {
            loginSystem = this.GetComponent <LoginSystem>();
            loginSystem.getUIManager(currentUIManager);
        }
        //根据玩家目前进入的进程来判断,后面直接挂到GameManger上
        if (currentProgress == GameProgress.Drawing)
        {
            try {
                paintFunction = FindObjectOfType <PaintFunction>();
                paintFunction.getUIManager(currentUIManager);
                print("GameMananger找到paintFunction");
            } catch
            {
                print("重试获取paintMananger");
            }
        }
        //加载登录系统
        if (currentProgress == GameProgress.LoginSystem)
        {
            loginSystem.Work();
        }

        //加载角色创建系统
        if (currentProgress == GameProgress.CharacterSelect)
        {
            characterSelectSystem.Work();
        }


        //================= 关于loading界面的控制 ========================
        if (currentLoadScene != null && needload)
        {
            currentUIManager.changeProgressBarValue(CommonGComp.LoadingProgressBar, currentLoadScene.progress * 100);
        }
        // if(currentLoadScene!=null)
        //     Debug.Log(GameManager.Instance.currentLoadScene.progress * 100);
        if (currentLoadScene != null && currentLoadScene.progress == 1 && needload)
        {
            currentUIManager.closeLoadingUI();
            print("关闭Loading");
            currentLoadScene = null;
            needload         = false;
        }


        //================= 控制TipsWindow的开启(服务器传输使用) ================
        if (shouldShowWindow)
        {
            currentUIManager.showTipsWindow();
            shouldShowWindow = false;
        }
        if (currentUIManager.tipsWindow.isPanelShowing)
        {
            currentUIManager.tipsWindowFront();
        }
    }
Пример #30
0
        public static int UserLogin(string txtUserName, string txtUserPass, SubSystem subSys, LoginSystem sys, out SysMember loginUser)
        {
            loginUser = null;
            int id = 0;
            if (txtUserName.Length <= 9)
                int.TryParse(txtUserName, out id);
            SqlQuery query = null;
            if (id > 0)
                query = DB.Select().From<SysMember>()
                                    .Where(SysMember.IdColumn).IsEqualTo(id);
            else
                query = DB.Select().From<SysMember>()
                                .Where(SysMember.MemberPhoneNumberColumn).IsEqualTo(txtUserName);
            if (subSys == SubSystem.Company)
                query.And(SysMember.CompanyIdColumn).IsGreaterThan(0);
            SysMemberCollection users = query.ExecuteAsCollection<SysMemberCollection>();
            if (users == null || users.Count == 0)
                return 1;
            bool bPass = false;
            SysMember user = null;
            foreach (SysMember item in users)
            {
                string enPass = Utilities.DESEncrypt(txtUserPass);
                bPass = Utilities.Compare(item.MemberPwd, txtUserPass) ||
                        Utilities.Compare(item.MemberPwd, enPass);
                if (bPass)
                {
                    if (Utilities.Compare(item.MemberPwd, txtUserPass))
                        item.MemberPwd = enPass;
                    user = item;
                    break;
                }
            }
            if (!bPass)
                return 2;
            if (user.MemberRoleId == null)
                user.MemberRoleId = 0;
            if (user.CompanyRoleId == null)
                user.CompanyRoleId = 0;
            if (user.AdminRoleId == null)
                user.AdminRoleId = 0;
            int roleId = 0;
            switch (subSys)
            {
                case SubSystem.Admin:
                    roleId = Convert.ToInt32(user.AdminRoleId);
                    break;
                case SubSystem.Member:
                    roleId = Convert.ToInt32(user.MemberRoleId);
                    break;
                case SubSystem.Company:
                    roleId = Convert.ToInt32(user.CompanyRoleId);
                    break;
            }

            if (GetUserRoleAssignmentById(roleId) == null)
            {
                return 3;
            }
            if (user.MemberStatus != 1)
            {
                return 4;
            }
            user.ValidateWhenSaving = false;
            user.LastLoginSubSys = (int)subSys;
            user.LastLoginDate = DateTime.Now;
            user.Save(user.Id);
            if (sys != LoginSystem.Mobile)
                Utilities.LoginSigIn(user.Id, subSys, sys);
            loginUser = user;
            return 0;
        }
Пример #31
0
    void OnGUI()
    {
        if (_window != null)
        {
            GUI.contentColor = Color.red;              // Apply Red color to Button
            GUILayout.Label("PHP Source Folder & Secure Key", EditorStyles.boldLabel);

            URL = EditorGUILayout.TextField("Folder URL", URL);
            Key = EditorGUILayout.TextField("Secure Key", Key);

            GUILayout.Label("First Step : Before Login", EditorStyles.boldLabel);
            GUILayout.Label(MSG);

            AccountManager = (GameObject)EditorGUILayout.ObjectField("Account Manager:", AccountManager, typeof(GameObject), true);
            if (GUILayout.Button("Configure ! STEP 1") && AccountManager != null)
            {
                LoginManager    = AccountManager.GetComponent <LoginSystem> ();
                RegisterManager = AccountManager.GetComponent <RegisterSystem> ();
                ForgetManager   = AccountManager.GetComponent <forgetPassword> ();
                ResetManager    = AccountManager.GetComponent <ResetPassword> ();
                ActiveManager   = AccountManager.GetComponent <ActiveAccount> ();
                //			AccountM = Manager.GetComponent<AccountSystem>();

                PlayerPrefs.SetString("registerURL", URL + "/register.php");

                PlayerPrefs.SetString("LoginUrl", URL + "/login.php");
                ManagerLogin.LoginUrl       = URL + "/login.php";
                LoginManager.LoginUrl       = URL + "/login.php";
                ManagerLogin.SecureKey      = Key;
                ManagerLogin.checkBannedUrl = URL + "/checkbanned.php";
                ManagerLogin.checkBannedUrl = URL + "/checkbanned.php";
                Manager.securePassword      = Key;
                Manager.checkBannedUrl      = URL + "/checkbanned.php";
                Manager.RegisterUrl         = URL + "/register.php";

                RegisterManager.checkBannedUrl = URL + "/checkbanned.php";
                ManagerForget.UrlSendCode      = URL + "/sendcode.php";
                ForgetManager.UrlSendCode      = URL + "/sendcode.php";
                ManagerForget.securePassword   = Key;
                ManagerReset.ResetUrl          = URL + "/resetpassword.php";
                ResetManager.ResetUrl          = URL + "/resetpassword.php";
                ManagerReset.securePassword    = Key;
                ManagerActive.activeURL        = URL + "/activeaccount.php";
                ManagerActive.resendURL        = URL + "/resendactive.php";
                ManagerActive.securePassword   = Key;
                ActiveManager.activeURL        = URL + "/activeaccount.php";
                ActiveManager.resendURL        = URL + "/resendactive.php";


                PlayerPrefs.SetString("UrlSendCode", URL + "/sendcode.php");

                PlayerPrefs.SetString("ResetUrl", URL + "/resetpassword.php");

                PlayerPrefs.SetString("UpdateURL", URL + "/update.php");

                PlayerPrefs.SetString("RefreshURL", URL + "/refresh.php");
                PlayerPrefs.SetString("ActiveAccountURL", URL + "/activeaccount.php");
                PlayerPrefs.SetString("CheckBanned", URL + "/checkbanned.php");
                PlayerPrefs.SetString("ResendActive", URL + "/resendactive.php");



                _window.Close();
                success_window = (gaseditor)EditorWindow.GetWindow(typeof(gaseditor), true, "Done !");
                //Manager.registerURL = "ololo";
                //Manager.oo = ":";

                EditorUtility.SetDirty(AccountManager);

                AssetDatabase.Refresh();
            }

            GUILayout.Label("Second Step: After Login", EditorStyles.boldLabel);
            GUILayout.Label(MSG2);

            MAS = (GameObject)EditorGUILayout.ObjectField("Manager GameObject:", MAS, typeof(GameObject), true);


            if (GUILayout.Button("Configure ! STEP 2") && MAS != null)
            {
                AccountM = MAS.GetComponent <AccountSystem>();


                AccountM.UpdateURL      = URL + "/update.php";
                AccountM.RefreshURL     = URL + "/refresh.php";
                AccountM.securePassword = Key;
                //ManagerLogin.LoginUrl = URL + "/login.php";
                //	ManagerLogin.checkBannedUrl = URL + "/checkbanned.php";
                //Manager.registerURL = URL + "/register.php";
                //Manager.checkBannedUrl = URL + "/checkbanned.php";
                //	ManagerForget.UrlSendCode = URL + "/sendcode.php";
                //	ManagerReset.ResetUrl = URL + "/resetpassword.php";
                //	ManagerActive.activeURL = URL + "/activeaccount.php";
                //	ManagerActive.resendURL = URL + "/resendactive.php";
                PlayerPrefs.SetString("UpdateURL", URL + "/update.php");

                PlayerPrefs.SetString("RefreshURL", URL + "/refresh.php");



                _window.Close();
                success_window2 = (gaseditor)EditorWindow.GetWindow(typeof(gaseditor), true, "Done !");
                //Manager.registerURL = "ololo";
                //Manager.oo = ":";

                EditorUtility.SetDirty(MAS);

                AssetDatabase.Refresh();
            }



            if (AccountManager == null)
            {
                //GUI.contentColor = Color.red;
                MSG = "Please Attach Account Manager !";
            }
            else
            {
                MSG = "Good !";
            }

            if (MAS == null)
            {
                GUI.contentColor = Color.red;
                MSG2             = "Please Attach Manager !";
            }
            else
            {
                MSG2 = "Good !";
            }
        }
        if (success_window != null)
        {
            GUILayout.Label("We Got These :", EditorStyles.boldLabel);

            GUILayout.Label("Register URL : " + PlayerPrefs.GetString("registerURL"));
            GUILayout.Label("Login URL : " + PlayerPrefs.GetString("LoginUrl"));
            GUILayout.Label("Send URL : " + PlayerPrefs.GetString("UrlSendCode"));
            GUILayout.Label("Reset URL : " + PlayerPrefs.GetString("ResetUrl"));
            GUILayout.Label("Active Account URL : " + PlayerPrefs.GetString("ActiveAccountURL"));
            GUILayout.Label("Check Banned URL : " + PlayerPrefs.GetString("CheckBanned"));
            GUILayout.Label("Resend Active URL : " + PlayerPrefs.GetString("ResendActive"));



            if (GUILayout.Button("Seems Good  !"))
            {
                success_window.Close();
            }
            if (GUILayout.Button("Nope ! , Re-Setup"))
            {
                success_window.Close();
                _window = (gaseditor)EditorWindow.GetWindow(typeof(gaseditor), true, "GAS Database Setup");
            }
        }



        if (success_window2 != null)
        {
            GUILayout.Label("We Got These :", EditorStyles.boldLabel);


            GUILayout.Label("Update URL : " + PlayerPrefs.GetString("UpdateURL"));
            GUILayout.Label("Refresh URL : " + PlayerPrefs.GetString("RefreshURL"));



            if (GUILayout.Button("Seems Good  !"))
            {
                success_window2.Close();
            }
            if (GUILayout.Button("Nope ! , Re-Setup"))
            {
                success_window2.Close();
                _window = (gaseditor)EditorWindow.GetWindow(typeof(gaseditor), true, "GAS Database Setup");
            }
        }
    }
Пример #32
0
        public async Task <IActionResult> Register(LoginSystem loginSystem)
        {
            loginSystem.Step = "register";

            if (ModelState.IsValid)
            {
                try
                {
                    var securityToken = SecurityUsing.CreateCryptographicallySecureGuid().ToString();

                    // Chiffrement du token (avec la passphrase du site et le mot de passe utilisateur)
                    var firstCrypt  = SecurityUsing.BytesToHex(Aes.Encrypt(_globalSettings.Value.AesPassphrase, securityToken));
                    var secondCrypt = SecurityUsing.BytesToHex(Aes.Encrypt(loginSystem.RegisterModel.Password, firstCrypt));

                    await _vaultClient.V1.Secrets.KeyValue.V2.WriteSecretAsync($"safeblock/io/tokens/{SecurityUsing.Sha1(loginSystem.RegisterModel.Mail)}", new Dictionary <string, object>
                    {
                        { "token", secondCrypt },
                        { "timestamp", DateTimeOffset.Now.ToUnixTimeSeconds() }
                    });

                    var newUser = new ApplicationUser()
                    {
                        UserName        = loginSystem.RegisterModel.Mail.ToLower(),
                        Email           = loginSystem.RegisterModel.Mail.ToLower(),
                        Token           = securityToken,
                        AccountType     = "User",
                        RegisterDate    = DateTime.Now,
                        HasUsingTor     = SecurityUsing.IsTorVisitor(HttpContext.Connection.RemoteIpAddress.ToString()),
                        RegisterIp      = HttpContext.Connection.RemoteIpAddress.ToString(),
                        RegisterContext = JsonConvert.SerializeObject(HttpContext.Request.Headers, Formatting.Indented),
                        IsAllowed       = true,
                        TwoFactorPolicy = "None"
                    };

                    var creationResult = await _userManager.CreateAsync(newUser, securityToken);

                    if (creationResult.Succeeded)
                    {
                        if (!_env.IsDevelopment())
                        {
                            var code = await _userManager.GenerateEmailConfirmationTokenAsync(newUser);

                            var callbackUrl = Url.Page(
                                "/account/activate/",
                                pageHandler: null,
                                values: new { userId = newUser.Id, code },
                                protocol: Request.Scheme);
                            await MailUsing.SendConfirmationEmail(loginSystem.RegisterModel.Mail, callbackUrl, @"F:\SafeBlock.io\Backup\unx\SafeBlock.io\robots.txt");
                        }
                        await _signInManager.SignInAsync(newUser, loginSystem.LoginModel.KeepSession);

                        return(RedirectToAction("Index", "Dashboard", new { firstLogin = true }));
                    }
                    foreach (var resultError in creationResult.Errors)
                    {
                        ModelState.AddModelError(string.Empty, resultError.Description);
                    }
                }
                catch (Exception e)
                {
                    ViewBag.CreationError = true;
                    ViewBag.Exception     = e.Message;
                }
            }

            return(View("GettingStarted", loginSystem));
        }
Пример #33
0
 void OnClickSingle()
 {
     LoginSystem.LoginSingle();
 }