상속: MonoBehaviour
예제 #1
1
 public void Execute()
 {
     List<string> argList =ArgumentsParser.Parse(_Request.Content);
     int appType = argList[3].ToInt();
     LoginParameter loginParameter = new LoginParameter()
     {
         LoginId = argList[0],
         Password=argList[1],
         Version=argList[2],
         AppType=(AppType)argList[3].ToInt(),
         Request=_Request
     };
     LoginManager loginManager = new LoginManager();
     loginManager.StateLoadingCompleted += OnLoginStateLoadingCompleteCallback;
     loginManager.Login(loginParameter);
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            LoginManager login = new LoginManager();
            login.LogInWithReadPermissions(readPermissions.ToArray(), delegate(LoginManagerLoginResult result, NSError error)
            {
                if (error != null)
                {
                    UpdateCredentials(string.Empty);
                }
                else if (result.IsCancelled)
                {
                    UpdateCredentials(string.Empty);
                }
                else
                {
                    var accessToken = result.Token;
                    UpdateCredentials(accessToken.TokenString);

                    ((AppDelegate)UIApplication.SharedApplication.Delegate).UpdateRootViewController(new TODOViewController());
                }
            });

        }
예제 #3
0
        public void LoginWithValidCredentials()
        {
            // Arrange
            var mockEmployeeRepository = new Mock<IEmployeeRepository>();
            var username = "******";
            var password = "******";
            var employee = new Employee
            {
                UserName = username,
                Password = password
            };
        
            mockEmployeeRepository.Setup(
                    r => r.Find(It.IsAny<ISpecification<Employee>>()))
                .Returns(new List<Employee>{ employee });
                
                       
            var sut = new LoginManager(mockEmployeeRepository.Object);


            // Act
            var result = sut.Login(username, password);

            // Assert
            Assert.AreEqual("Login successful!", result);

        }
예제 #4
0
        private void btnSingIn_Click(object sender, EventArgs e)
        {
            string portal = textBoxPortal.Text;
            string name = textBoxLogin.Text;
            string password = textBoxPass.Text;

            Properties.Settings.Default.Portal = portal;
            Properties.Settings.Default.UserName = name;

            if (checkBoxPass.Checked) {
                Properties.Settings.Default.Password = password;
                Properties.Settings.Default.SavePassword = true;
            } else {
                Properties.Settings.Default.Password = "";
                Properties.Settings.Default.SavePassword = false;
            }
            Properties.Settings.Default.Save();

            try {
                ILoginManager lm = new LoginManager();
                lm.Authentificate(portal, name, password);
            } catch (TeamLabExpception ex) {
                labelWrongCredentials.Text = ex.Message;
                this.DialogResult = System.Windows.Forms.DialogResult.Retry;
            }
        }
        public static bool Login(string login, string password)
        {
            if (File.Exists(CommunConfig.getInstance().userDirectory + login + ".xml"))
            {
                manager = new LoginManager(login, password);
                isLogged = manager.isLogged;
                if (isLogged)
                {
                    _login = login;
                    SurfaceWindow1.HideLoginButton();
                }
                else
                {
                    SurfaceWindow1.ShowLoginButton();
                }

                if (addImage != null && wantToAddImageAfterLogin)
                {
                  SelectionUser.getInstance().AddImage(addImage);
                  wantToAddImageAfterLogin = false;
                }
                return isLogged;
            }
            else
            {
                SurfaceWindow1.ShowLoginButton();
                return false;
            }
        }
 public static void Disconnect()
 {
     isLogged = false;
     manager = null;
     _login = "";
     SurfaceWindow1.ShowLoginButton();
     SurfaceWindow1.StaticGotoMenu();
 }
예제 #7
0
    void Start()
    {
        playerName = GameObject.Find ("InputName").GetComponent<InputField> ();
        Address = GameObject.Find ("InputAddress").GetComponent<InputField> ();
        RoomNo = GameObject.Find ("InputRoomNo").GetComponent<InputField> ();

        loginManager = GameObject.Find ("LoginManager").GetComponent<LoginManager> ();
    }
예제 #8
0
 public AccountController(
     LoginManager loginManager,
     UsersManager usersManager,
     IAuthenticationManager authenticationManager)
 {
     this.loginManager = loginManager;
     this.usersManager = usersManager;
     this.authenticationManager = authenticationManager;
 }
예제 #9
0
 public void LogOut()
 {
     try
     {
         var loginManager = new LoginManager();
         loginManager.LogOut();
     }
     catch (Exception ex)
     {
         //Handle exception
     }
 }
예제 #10
0
 public void Login()
 {
     try
     {
         var loginManager = new LoginManager();
         loginManager.LogOut();
         loginManager.LogInWithReadPermissions(_readPermissions, LoginManagerRequestTokenHandler);
     }
     catch (Exception ex)
     {
         //Handle exception
     }
 }
예제 #11
0
        private Sdk(string gameId, string gameSecret)
        {
            initialized = true;

            loginManager = new LoginManager(gameId, gameSecret);

            AndroidJavaClass RESTAPI = new AndroidJavaClass("kr.ac.korea.ee.shygiants.gameunivlogin.RESTAPI");
            RESTAPI.CallStatic("init", url);

            //			// Get main activity
            //			AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            //			mainActivity = UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
        }
예제 #12
0
 public iOSFacebookProbe()
 {
     _loginManager = new LoginManager();
     _loginResultHandler = new LoginManagerRequestTokenHandler((loginResult, error) =>
         {
             if (error == null && loginResult.Token != null)
                 SensusServiceHelper.Get().Logger.Log("Facebook login succeeded.", SensusService.LoggingLevel.Normal, GetType());
             else if (loginResult != null && loginResult.IsCancelled)
                 SensusServiceHelper.Get().Logger.Log("Facebook login cancelled.", SensusService.LoggingLevel.Normal, GetType());
             else
                 SensusServiceHelper.Get().Logger.Log("Facebook login failed.", SensusService.LoggingLevel.Normal, GetType());
         });
 }
 public static LoginManager getLoginManager()
 {
     if (isLogged && _login!="")
     {
         if (manager == null)
         {
             manager = new LoginManager(_login);
         }
         else
         {
             return manager;
         }
     }
     return null;
 }
예제 #14
0
    void Start()
    {
        wrapper = GameObject.Find("Wrapper").GetComponent<Wrapper>();
        userManager = GameObject.Find("UserManager").GetComponent<UserManager>();
        loginManager = GameObject.Find("LoginManager").GetComponent<LoginManager>();

        // 駒のprefab情報を取得
        koma = (GameObject)Resources.Load ("Prefabs/koma");
        parentObject = GameObject.Find ("board");

        url = "http://" + loginManager.GetURL()
            + "/plays/" + userManager.play_id.ToString() + "/pieces";

        //KomaInfoGet ();
    }
예제 #15
0
		public async Task<FacebookUser> GetFacebookToken()
		{
			var loginManager = new LoginManager();

			var token = Facebook.CoreKit.AccessToken.CurrentAccessToken;
			if (token == null)
			{
				var result = await loginManager.LogInWithReadPermissionsAsync(new string[] {"public_profile", "email", "user_friends"});
				token = result.Token;
			}
			if (token == null)
				return null;
			
			var fbUser = await getUserData(token);
			return fbUser;
		}
예제 #16
0
    void Awake()
    {
        if (!mInstance)
            mInstance = this;
        else
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(this.gameObject);

        loginManager = GetComponent<LoginManager>();
        userData = GetComponent<UserData>();
        ranking = GetComponent<Ranking>();
           // userData.Init();
    }
예제 #17
0
        public void LoginBlankUserNameShouldNotCallRepositoryFind()
        {
            // arrange
            var mockEmployeeRepository = new Mock<IEmployeeRepository>();
            mockEmployeeRepository.Setup(
                r => r.Find(It.IsAny<ISpecification<Employee>>()))
                .Returns(new List<Employee>());

            IEmployeeRepository repository = mockEmployeeRepository.Object;
            var sut = new LoginManager(repository);

            // act
            var result = sut.Login(string.Empty, "Bl@st123");

            // Assert
            mockEmployeeRepository.Verify(r => r.Find(It.IsAny<ISpecification<Employee>>()), Times.Never);

        }
예제 #18
0
 private void OnLoginStateLoadingCompleteCallback(LoginManager sender,AppType appType)
 {
     sender.StateLoadingCompleted -= OnLoginStateLoadingCompleteCallback;
     if (AppType.Mobile == appType)
     {
         Token token = SessionManager.Default.GetToken(_Request.ClientInfo.Session);
         _Request.UpdateContent(new PacketContent( Mobile.Manager.Login(token)));
         SendCenter.Default.Send(_Request);
     }
     else if (appType == AppType.CppTrader)
     {
         LoginResult result = new LoginResult { SessionId = _Request.ClientInfo.Session.ToString(), ServerDateTime=DateTime.Now.ToStandrandDateTimeStr() };
         _Request.UpdateContent(JsonResponse.NewResult(_Request.ClientInfo.ClientInvokeId,result));
         SendCenter.Default.Send(_Request);
     }
     if (System.Configuration.ConfigurationManager.AppSettings["MobileDebug"] == "true")
     {
     }
 }
예제 #19
0
        public TCSplashControl(UserEntity user)
        {
            InitializeComponent();
            _user = user;
            _loginManager = new LoginManager();
            if (_user != null && _user.Photo != null) avatarControl1.SetAvatar(_user.Photo); 
            avatarControl1.SetPictureSize();

            _selectHospitalCtl = new SelectHospitalControl();
            _selectHospitalCtl.Dock = DockStyle.Top;
            _selectHospitalCtl.SelectHospital += new Action<HospitalEventArgs>(_selectHospitalCtl_SelectHospital);
            _selectHospitalCtl.CancelEvent += new CancelEventHandler(_selectHospitalCtl_CancelEvent);

            _msg = _user.UserName + " 正在登录...";
            _waitCtl = new WaitControl(_msg);
            _waitCtl.CancelEvent += new CancelEventHandler(_waitCtl_CancelEvent);
            _waitCtl.Dock = DockStyle.Top;
            panel1.Controls.Clear();
            panel1.Controls.Add(_waitCtl);
        }
 private void HandleFacebookLoginClicked()
 {
     LoginManager login = new LoginManager();
     login.LogInWithReadPermissions(readPermissions.ToArray(), delegate(LoginManagerLoginResult result, NSError error)
     {
         if (error != null)
         {
             App.OnFacebookAuthFailed();
         }
         else if (result.IsCancelled)
         {
             App.OnFacebookAuthFailed();
         }
         else
         {
             var accessToken = result.Token;
             App.OnFacebookAuthSuccess(accessToken.TokenString);
         }
     });
 }
예제 #21
0
        public void LoginWithInvalidPasswordThrowsException()
        {
            // arrange
            var mockEmployeeRepository = new Mock<IEmployeeRepository>();
            var employee = new Employee
            {
                UserName = "******",
                Password = "******"
            };
            mockEmployeeRepository.Setup(
                r => r.Find(It.IsAny<ISpecification<Employee>>()))
                .Returns(new List<Employee> { employee });

            IEmployeeRepository repository = mockEmployeeRepository.Object;
            var sut = new LoginManager(repository);

            // act
            var result = sut.Login("*****@*****.**", "WrongPassword");

        }
    // Use this for initialization
    void Start()
    {
        wrapper = GameObject.Find ("Wrapper").GetComponent<Wrapper> ();
        userManager = GameObject.Find("UserManager").GetComponent<UserManager>();
        loginManager = GameObject.Find("LoginManager").GetComponent<LoginManager>();
        komaGenerator = GameObject.Find("KomaGenerator").GetComponent<KomaGenerator>();

        playerInfo = this.GetComponent<PlayerInformation>();
        playInfo = this.GetComponent<PlayingInformation>();

        UsersURL = "http://" + loginManager.GetURL()
            + "/plays/" + userManager.play_id.ToString() + "/users";
        PlayURL = "http://" + loginManager.GetURL()
            + "/plays/" + userManager.play_id.ToString();
        Debug.Log (UsersURL);
        Debug.Log (PlayURL);

        UsersInfoGet ();
        PlayInfoGet ();
    }
예제 #23
0
    void Awake()
    {
        if (!mInstance)
            mInstance = this;
        else
        {
            Destroy(this.gameObject);
            return;
        }

        DontDestroyOnLoad(this.gameObject);

        loginManager = GetComponent<LoginManager>();
        facebookFriends = GetComponent<FacebookFriends>();
        userData = GetComponent<UserData>();
        userHiscore = GetComponent<UserHiscore>();
        ranking = GetComponent<Ranking>();
        challengesManager = GetComponent<ChallengersManager>();
        challengeData = GetComponent<ChallengeData>();
        userData.Init();
    }
예제 #24
0
 public void ProcessRequest(HttpContext context)
 {
     HttpRequest request = context.Request;
     HttpResponse response = context.Response;
     string Status = request.Params["Status"];
     string Token = request.Params["Token"];
     try
     {
         if (Status.Equals("Accept"))
         {
             string privateKey = System.Configuration.ConfigurationManager.AppSettings["privateKey"];
             string serviceUrl = System.Configuration.ConfigurationManager.AppSettings["serviceUrl"];
             string entryPoint = System.Configuration.ConfigurationManager.AppSettings["entryPoint"]; ;
             LoginManager client = new LoginManager(new Uri(serviceUrl));
             ProcessLoginOut result = client.ProcessAuthentication(Token, privateKey, entryPoint);
             switch (result.OperationStatus)
             {
                 case OperationStatus.Ok:
                     HttpCookie myCookie = new HttpCookie("User");
                     DateTime now = DateTime.Now;
                     myCookie.Value = result.User;
                     myCookie.Expires = now.AddMinutes(5);
                     context.Response.Cookies.Add(myCookie);
                     context.Response.Redirect("Private.aspx");
                     break;
                 case OperationStatus.NotFound:
                     context.Response.Redirect("Index.aspx");
                     break;
             }
             context.Response.Redirect("Index.aspx");
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #25
0
 public async Task AlwaysReturnsASingleResult()
 {
     await LoginManager
     .RefreshToken(Password)
     .SingleAsync();
 }
예제 #26
0
        /// <summary>
        /// Tries to Login to the Forums
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void LoginBtnClick(object sender, EventArgs e)
        {
            if (this.ForumUrl.Text.StartsWith("http://"))
            {
                if (!this.ForumUrl.Text.EndsWith("/"))
                {
                    this.ForumUrl.Text += "/";
                }

                CacheController.Instance().UserSettings.CurrentForumUrl = this.ForumUrl.Text;
            }

            string welcomeString = this.rm.GetString("lblWelcome"), lblFailed = this.rm.GetString("lblFailed");

            if (this.GuestLogin.Checked)
            {
                this.UserNameField.Text = "Guest";
                this.PasswordField.Text = "Guest";

                this.label3.Text         = string.Format("{0}{1}", welcomeString, this.UserNameField.Text);
                this.label3.ForeColor    = Color.Green;
                this.LoginButton.Enabled = false;

                if (
                    CacheController.Instance().UserSettings.ForumsAccount.Any(
                        item => item.ForumURL == CacheController.Instance().UserSettings.CurrentForumUrl))
                {
                    CacheController.Instance().UserSettings.ForumsAccount.RemoveAll(
                        item => item.ForumURL == CacheController.Instance().UserSettings.CurrentForumUrl);
                }

                var forumsAccount = new ForumAccount
                {
                    ForumURL     = CacheController.Instance().UserSettings.CurrentForumUrl,
                    UserName     = this.UserNameField.Text,
                    UserPassWord = this.PasswordField.Text,
                    GuestAccount = false
                };

                CacheController.Instance().UserSettings.ForumsAccount.Add(forumsAccount);
                CacheController.Instance().UserSettings.CurrentUserName = this.UserNameField.Text;

                this.timer1.Enabled = true;
            }
            else
            {
                // Encrypt Password
                this.PasswordField.Text =
                    Utility.EncodePassword(this.PasswordField.Text).Replace("-", string.Empty).ToLower();

                var loginManager = new LoginManager(this.UserNameField.Text, this.PasswordField.Text);

                if (loginManager.DoLogin(CacheController.Instance().UserSettings.CurrentForumUrl))
                {
                    this.label3.Text         = string.Format("{0}{1}", welcomeString, this.UserNameField.Text);
                    this.label3.ForeColor    = Color.Green;
                    this.LoginButton.Enabled = false;

                    if (
                        CacheController.Instance().UserSettings.ForumsAccount.Any(
                            item => item.ForumURL == CacheController.Instance().UserSettings.CurrentForumUrl))
                    {
                        CacheController.Instance().UserSettings.ForumsAccount.RemoveAll(
                            item => item.ForumURL == CacheController.Instance().UserSettings.CurrentForumUrl);
                    }

                    var forumsAccount = new ForumAccount
                    {
                        ForumURL     = CacheController.Instance().UserSettings.CurrentForumUrl,
                        UserName     = this.UserNameField.Text,
                        UserPassWord = this.PasswordField.Text,
                        GuestAccount = false
                    };

                    CacheController.Instance().UserSettings.ForumsAccount.Add(forumsAccount);
                    CacheController.Instance().UserSettings.CurrentUserName = this.UserNameField.Text;

                    this.timer1.Enabled = true;
                }
                else
                {
                    this.label3.Text      = lblFailed;
                    this.label3.ForeColor = Color.Red;
                }
            }
        }
예제 #27
0
        /// <summary>
        /// 登录校验
        /// </summary>
        private void ValidateLogin()
        {
            StringBuilder str              = new StringBuilder();
            HttpContext   context          = System.Web.HttpContext.Current;
            string        username         = context.Request.Params["username"];
            string        password         = context.Request.Params["password"];
            string        verificationCode = context.Request.Params["verificationCode"];

            if (string.IsNullOrEmpty(username))
            {
                str.Append("{\"IsSuccess\":false,\"Msg\":\"用户名不能为空\"}");
                context.Response.Write(str.ToString());
                return;
            }
            if (string.IsNullOrEmpty(password))
            {
                str.Append("{\"IsSuccess\":false,\"Msg\":\"密码不能为空\"}");
                context.Response.Write(str.ToString());
                return;
            }
            if (string.IsNullOrEmpty(verificationCode))
            {
                str.Append("{\"IsSuccess\":false,\"Msg\":\"验证码不能为空\"}");
                context.Response.Write(str.ToString());
                return;
            }

            object verificationCodeServer = context.Session[ConfigManager.GetVerificationCode_SessionName()];

            if (verificationCodeServer == null || verificationCodeServer.Equals(String.Empty))
            {
                str.Append("{\"IsSuccess\":false,\"Msg\":\"服务器端找不到验证码\"}");
                context.Response.Write(str.ToString());
                return;
            }


            if (string.IsNullOrEmpty(verificationCode) || !verificationCode.ToString().Equals(verificationCodeServer.ToString(), StringComparison.CurrentCultureIgnoreCase))
            {
                str.Append("{\"IsSuccess\":false,\"Msg\":\"验证码不正确\"}");
                context.Response.Write(str.ToString());
                return;
            }

            object loginCount = context.Session["loginCount"];
            int    waitTime   = ConfigManager.GetLoginErrorWait();

            if (loginCount != null && loginCount.ToInt32(0) >= ConfigManager.GetAllowLoginCount() && !string.IsNullOrEmpty(context.Session["loginForbidTime"].ToString2()))
            {
                DateTime oldTime = DateTime.Parse(context.Session["loginForbidTime"].ToString2());
                TimeSpan span    = DateTime.Now - oldTime;

                if (span.Minutes < waitTime)
                {
                    str.Append("{\"IsSuccess\":false,\"Msg\":\"你登录错误已超过" + ConfigManager.GetAllowLoginCount() + "次,请" + (waitTime - span.Minutes) + "分钟后重试\"}");
                    context.Response.Write(str.ToString());
                    return;
                }
                else
                {
                    context.Session["loginCount"]      = 0;
                    context.Session["loginForbidTime"] = "";
                }
            }
            if (systemBLL.UserLogin(username, password))
            {
                if (loginCount != null)
                {
                    context.Session["loginCount"] = 0;
                }
                AppUser workUser = new AppUser();

                workUser = systemBLL.InitAppUser(username, password).Result;
                //更新用户登录时间
                systemBLL.UpdateLoginTime(workUser.UserID, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                context.Session[ConfigManager.GetSignInAppUserSessionName()] = workUser;

                LoginManager.SetLoginID(workUser.UserID);
                if (string.IsNullOrEmpty(workUser.qyID))
                {
                    str.Append("{\"IsSuccess\":true,\"Msg\":\"登录成功\",\"url\":\"/WxjzgcjczyPage/MainPage/Index.aspx\"}");
                }
                else
                {
                    str.Append("{\"IsSuccess\":true,\"Msg\":\"登录成功\",\"url\":\"/WxjzgcjczyPage/MainPage/Index2.aspx\"}");
                }
                context.Response.Write(str.ToString());
            }
            else
            {
                loginCount = context.Session["loginCount"];
                if (loginCount == null)
                {
                    loginCount = 1;
                }
                else
                {
                    loginCount = loginCount.ToInt32(0) + 1;
                }
                context.Session["loginCount"] = loginCount;

                if (loginCount != null && loginCount.ToInt32(0) == ConfigManager.GetAllowLoginCount())
                {
                    context.Session["loginForbidTime"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                }

                str.Append("{\"IsSuccess\":false,\"Msg\":\"用户名或密码错误\"}");
                context.Response.Write(str.ToString());
            }
        }
예제 #28
0
        private bool LoadChallengeDetail()
        {
            UIViewController controller = null;

            if (Challenge.TypeCode == "SHARE")
            {
                controller = LoadChallengeDetail("ShareViewController");
                ShareViewController shareViewController = controller as ShareViewController;
                shareViewController.SubmitButton = SubmitButton;
            }
            else if (Challenge.TypeCode == "INVITE")
            {
                SL.Manager.RefreshShareTemplate(Challenge.ShareTemplateURL, SendInviteMessage);
            }
            else if (Challenge.TypeCode == "POSTERING")//else if (Challenge.TypeCode == "COLLATERAL TRACKING" && Challenge.TypeCodeDisplayName == "Postering")
            {
                controller = LoadChallengeDetail("PosteringViewController");
            }
            else if (Challenge.TypeCode == "COLLATERAL TRACKING")
            {
                //controller = LoadChallengeDetail("CollateralViewController");
                controller = LoadChallengeDetail("PosteringViewController");//display always Postering
            }
            else if (Challenge.TypeCode == "FB ENGAGEMENT")
            {//controller = LoadChallengeDetail("FacebookEngagementViewController");
                var permissions  = new string[] { "user_posts" };
                var loginManager = new LoginManager();

                if (Facebook.CoreKit.AccessToken.CurrentAccessToken != null)
                {
                    var graphRequest = new Facebook.CoreKit.GraphRequest("me/permissions", null);
                    graphRequest.Start(new Facebook.CoreKit.GraphRequestHandler(
                                           (Facebook.CoreKit.GraphRequestConnection connection, NSObject result, NSError error) =>
                    {
                        bool hasPermission = false;
                        if (error == null)
                        {
                            NSArray permissions1 = (NSArray)result.ValueForKey(new NSString("data"));
                            foreach (NSDictionary dict in NSArray.FromArray <NSObject>(permissions1))
                            {
                                if (dict.ValueForKey(new NSString("permission")).Description == permissions[0])
                                {
                                    if (dict.ValueForKey(new NSString("status")).Description == "granted")
                                    {
                                        hasPermission = true;
                                    }
                                }
                            }
                        }
                        if (hasPermission)
                        {
                            if (Challenge?.IsReshareReq ?? false)
                            {
                                CheckFacebookSharingEnabled(permissions);
                            }
                            else
                            {
                                SubmitEngagement();
                            }
                        }
                    }
                                           ));
                }
                else
                {
                    loginManager.LogInWithReadPermissions(permissions, this,
                                                          (LoginManagerLoginResult result, NSError error) =>
                    {
                        LogHelper.LogUserMessage("FB_USER_POST", "asking for permissions");
                        if (result?.GrantedPermissions != null && result.GrantedPermissions.Contains(permissions[0]))
                        {
                            LogHelper.LogUserMessage("FB_USER_POST", "permission failed");
                            if (Challenge?.IsReshareReq ?? false)
                            {
                                CheckFacebookSharingEnabled(permissions);
                            }
                            else
                            {
                                SubmitEngagement();
                            }
                        }
                        else
                        {
                            LogHelper.LogUserMessage("FB_USER_POST", "permission failed");
                            new UIAlertView(null, "There was a problem getting permission for " + permissions[0], this, "Ok").Show();
                        }
                    });
                }
            }

            if (controller != null)
            {
                NavigationController.PushViewController(controller, true);
            }
            return(controller != null);
        }
예제 #29
0
            public async Task TheUserToBePersistedShouldHaveIsDirtySetToFalse()
            {
                await LoginManager.Login(Email, Password);

                await Database.User.Received().Create(Arg.Is <IDatabaseUser>(receivedUser => receivedUser.IsDirty == false));
            }
예제 #30
0
            public async Task CallsTheGetMethodOfTheUserApi()
            {
                await LoginManager.RefreshToken(Password);

                await Api.User.Received().Get();
            }
예제 #31
0
 public ManageController(ApplicationUserManager userManager, LoginManager signInManager)
 {
     UserManager = userManager;
     SignInManager = signInManager;
 }
예제 #32
0
            public async Task CallsTheGetMethodOfTheUserApi()
            {
                await LoginManager.Login(Email, Password);

                await Api.User.Received().Get();
            }
 public static bool createLogin(string login, string password,string Date,String name,String firstname)
 {
     manager = new LoginManager();
     return manager.CreateNewLogin(login, password, Date, name, firstname);
 }
		// Verifies if you have granted the permissions, if not, ask for them
		void AskPermissions (string title, string message, string[] permissions, Action successHandler)
		{

			ShowMessageBox (title, message, "Maybe Later", new [] { "Ok" }, () => {
				// If they let you do things, ask for a new Access Token with the new permission
				var login = new LoginManager ();
				login.LogInWithPublishPermissions (permissions, this, (result, error) => {
					// Handle if something went wrong with the request
					if (error != null) {
						new UIAlertView ("Error...", error.Description, null, "Ok", null).Show ();
						return;
					}

					// Handle if the user cancelled the request
					if (result.IsCancelled) {
						new UIAlertView ("The request was cancelled", "If you are using a Test App Id, please, make sure that your account have an Administrator role at:\rhttps://developers.facebook.com/apps/appid/roles/", null, "OK", null).Show ();
						return;
					}

					// Do your magic if the request was successful
					successHandler ();
				});
			});
		}
예제 #35
0
 public async Task AlwaysReturnsASingleResult()
 {
     await LoginManager
     .SignUp(Email, Password, TermsAccepted, CountryId)
     .SingleAsync();
 }
예제 #36
0
 public LoginController(LoginManager loginManager)
 {
     _loginManager = loginManager;
 }
예제 #37
0
        public ActionResult RegisterUser(Employee register)
        {
            LoginManager login = new LoginManager();

            return(Json(login.RegisterUser(register), JsonRequestBehavior.AllowGet));
        }
예제 #38
0
        public ActionResult CheckLogin(Employee emp)
        {
            LoginManager login = new LoginManager();

            return(Json(login.CheckLogin(emp)));
        }
예제 #39
0
            public async Task PersistsTheUserWithTheSyncStatusSetToInSync()
            {
                await LoginManager.RefreshToken(Password);

                await Database.User.Received().Update(Arg.Is <IDatabaseUser>(receivedUser => receivedUser.SyncStatus == SyncStatus.InSync));
            }
예제 #40
0
 public async Task AlwaysReturnsASingleResult()
 {
     await LoginManager
     .SignUp(Email, Password)
     .SingleAsync();
 }
예제 #41
0
            public async Task PersistsTheUserToTheDatabase()
            {
                await LoginManager.RefreshToken(Password);

                await Database.User.Received().Update(Arg.Is <IDatabaseUser>(receivedUser => receivedUser.Id == User.Id));
            }
예제 #42
0
            public async Task CallsTheSignUpMethodOfTheUserApi()
            {
                await LoginManager.SignUp(Email, Password);

                await Api.User.Received().SignUp(Email, Password);
            }
예제 #43
0
파일: test.cs 프로젝트: LiuFeng1011/Diablo
    void OnGUI()
    {
        high = 10;
        if (CreateBtn("connect"))
        {
            SocketHelper.GetInstance().Connect(ConnectCallBack, null);
        }

        if (CreateBtn("send"))
        {
        }

        if (CreateBtn("login"))
        {
            LoginManager.Instance().httpFinishedDelegate = LoginSuccess;
            LoginManager.Instance().Login("liufeng1", "123456");
        }

        if (CreateBtn("reg"))
        {
            LoginManager.Instance().httpFinishedDelegate = LoginSuccess;
            LoginManager.Instance().Regist("liufeng1", "123456");
        }
        if (CreateBtn("shopping"))
        {
            PlayerRequest req = new PlayerRequest();
            req.Shopping(1001);
            req.Send();
        }
        if (CreateBtn("CHANGENAME"))
        {
            PlayerRequest req = new PlayerRequest();
            req.ChangeName("打算");
            req.Send();
        }
        if (CreateBtn("Set name color"))
        {
            PlayerRequest req = new PlayerRequest();
            req.SetNameColor(4001002);
            req.Send();
        }
        if (CreateBtn("Set role"))
        {
            PlayerRequest req = new PlayerRequest();
            req.SetRoleId(2001034);
            req.Send();
        }

        if (CreateBtn("Buy item"))
        {
            PlayerRequest req = new PlayerRequest();
            req.BuyItem(2002001);
            req.Send();
        }
        if (CreateBtn("Use item"))
        {
            PlayerRequest req = new PlayerRequest();
            req.UseItem(4001002, 1);
            req.Send();
        }

//		if(CreateBtn(  "CreateRoom"))
//		{
//			RoomRequest req = new RoomRequest();
//			req.CreateRoom(0);
//			req.Send();
//		}

        if (CreateBtn("InRoom"))
        {
            RoomRequest req = new RoomRequest();
            req.InRoom("5555");
            req.Send();
        }
        if (CreateBtn("Move"))
        {
            PlayerActionRequest req = new PlayerActionRequest();
            req.Move(new Vector3(1231, 324, 123), new Vector3(1, 1, 1));
            req.Send();
        }

        if (CreateBtn("TEST"))
        {
            TestRequest req = new TestRequest();
            req.Send();
        }
    }
예제 #44
0
 // Use this for initialization
 void Start()
 {
     loginManager = GameObject.Find ("LoginManager").GetComponent<LoginManager> ();
     userManager = GameObject.Find ("UserManager").GetComponent<UserManager> ();
 }
예제 #45
0
            public async Task PersistsTheUserToTheDatabase()
            {
                await LoginManager.Login(Email, Password);

                await Database.User.Received().Create(Arg.Is <IDatabaseUser>(receivedUser => receivedUser.Id == User.Id));
            }
 public CustomerController(CustomerManager custRepo, AccountManager acctRepo, TransactionManager transRepo, LoginManager loginRepo, BillpayManager bpayRepo, PayeeManager payeeRepo)
 {
     _custRepo  = custRepo;
     _acctRepo  = acctRepo;
     _loginRepo = loginRepo;
 }
예제 #47
0
            public async Task NotifiesShortcutCreatorAboutLogin()
            {
                await LoginManager.SignUp(Email, Password);

                ApplicationShortcutCreator.Received().OnLogin(Arg.Any <ITogglDataSource>());
            }
예제 #48
0
            public async Task NotifiesShortcutCreatorAboutLogin()
            {
                await LoginManager.LoginWithGoogle();

                ApplicationShortcutCreator.Received().OnLogin(Arg.Any <ITogglDataSource>());
            }
예제 #49
0
            public async Task PersistsTheUserWithTheSyncStatusSetToInSync()
            {
                await LoginManager.SignUp(Email, Password);

                await Database.User.Received().Create(Arg.Is <IDatabaseUser>(receivedUser => receivedUser.SyncStatus == SyncStatus.InSync));
            }
예제 #50
0
 public async Task AlwaysReturnsASingleResult()
 {
     await LoginManager
     .LoginWithGoogle()
     .SingleAsync();
 }
예제 #51
0
 public async Task ShouldAlwaysReturnASingleResult()
 {
     await LoginManager
     .Login(Email, Password)
     .SingleAsync();
 }
예제 #52
0
            public async Task PersistsTheUserWithTheSyncStatusSetToInSync()
            {
                await LoginManager.LoginWithGoogle();

                await Database.User.Received().Create(Arg.Is <IDatabaseUser>(receivedUser => receivedUser.SyncStatus == SyncStatus.InSync));
            }
예제 #53
0
		public async Task<string> GetFacebookToken()
		{
			var loginManager = new LoginManager();
			var result = await loginManager.LogInWithReadPermissionsAsync(new string[] {"public_profile", "email", "user_friends"});
			return result != null && result.Token != null ? result.Token.TokenString : null;
		}
예제 #54
0
            public async Task CallsTheGetWithGoogleOfTheUserApi()
            {
                await LoginManager.LoginWithGoogle();

                await Api.User.Received().GetWithGoogle();
            }
예제 #55
0
        public static TranslateableEnum <UserGroupId> GetEditableGroups(LoginManager manager)
        {
            var groups = EnumVal <UserGroupId> .Values.Where(g => EntryPermissionManager.CanEditGroupTo(manager, g)).ToArray();

            return(new TranslateableEnum <UserGroupId>(() => global::Resources.UserGroupNames.ResourceManager, groups));
        }
예제 #56
0
            public async Task UsesTheGoogleServiceToGetTheToken()
            {
                await LoginManager.LoginWithGoogle();

                await GoogleService.Received().GetAuthToken();
            }
예제 #57
0
        public ServerEntryViewModel(ServerStatusCache cache, DataManager cfg, Updater updater, LoginManager loginMgr, string address)
        {
            _cache     = cache;
            _cacheData = cache.GetStatusFor(address);
            _cfg       = cfg;
            _updater   = updater;
            _loginMgr  = loginMgr;

            this.WhenAnyValue(x => x.IsAltBackground)
            .Subscribe(_ => this.RaisePropertyChanged(nameof(BackgroundColor)));

            this.WhenAnyValue(x => x._cacheData.PlayerCount)
            .Subscribe(_ => this.RaisePropertyChanged(nameof(ServerStatusString)));

            this.WhenAnyValue(x => x._cacheData.Status)
            .Subscribe(_ =>
            {
                this.RaisePropertyChanged(nameof(IsOnline));
                this.RaisePropertyChanged(nameof(ServerStatusString));
            });

            this.WhenAnyValue(x => x._cacheData.Name)
            .Subscribe(_ => this.RaisePropertyChanged(nameof(Name)));

            this.WhenAnyValue(x => x._cacheData.Ping)
            .Subscribe(_ => this.RaisePropertyChanged(nameof(PingText)));

            _cfg.FavoriteServers.Connect()
            .Subscribe(_ => { this.RaisePropertyChanged(nameof(FavoriteButtonText)); });
        }
예제 #58
0
 public static void SignOut()
 {
     LoginManager.OnSignOut();
     FormsAuthentication.SignOut();
 }
		// Revoke all the permissions that you had granted, you will need to login again for ask the permissions again
		// You can also revoke a single permission, for more info, visit this link:
		// https://developers.facebook.com/docs/facebook-login/permissions/v2.3#revoking
		void RevokeAllPermissions (string userId)
		{
			// Create the request for delete all the permissions
			var request = new GraphRequest ("/" + userId + "/permissions", null, AccessToken.CurrentAccessToken.TokenString, null, "DELETE");
			var requestConnection = new GraphRequestConnection ();
			requestConnection.AddRequest (request, (connection, result, error) => {
				// Handle if something went wrong
				if (error != null) {
					ShowMessageBox ("Error...", error.Description, "Ok", null, null);
					return;
				}

				// If the revoking was successful, logout from FB
				if ((result as NSDictionary) ["success"].ToString () == "1")
					InvokeOnMainThread (() => {
						ShowMessageBox ("Successful", "All permissions have been revoked", "Ok", null, null);
						var login = new LoginManager ();
						login.LogOut ();
						LoggedOut ();
					});
				else
					InvokeOnMainThread (() => ShowMessageBox ("Ups...", "A problem has ocurred", "Ok", null, null));

			});
			requestConnection.Start ();
		}
예제 #60
0
 public ServerEntryViewModel(ServerStatusCache cache, DataManager cfg, Updater updater, LoginManager loginMgr,
                             FavoriteServer favorite)
     : this(cache, cfg, updater, loginMgr, favorite.Address)
 {
     Favorite = favorite;
 }