本文整理汇总了C#中LoginStatus类的典型用法代码示例。如果您正苦于以下问题:C# LoginStatus类的具体用法?C# LoginStatus怎么用?C# LoginStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoginStatus类属于命名空间,在下文中一共展示了LoginStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _processLogin
private void _processLogin(string loginName, LoginStatus status, Action<LoginResult> onResult) {
var result = new LoginResult { Status = status };
if (status == LoginStatus.Success) {
var session = _createOscarSession(loginName);
if (session == null) {
onResult(new LoginResult { Status = LoginStatus.SessionBlocked });
Log.Warn("Unable to create user session.");
return;
}
var preferences = new GetSettingsSection { DriverId = session.UserId, Section = _dSessionSection };
Services.Invoke(preferences, o => {
if (o != null) {
var defaultVehicle = o.Get(_dVehicle);
if (defaultVehicle.NotNull()) {
session.VehicleId = BplIdentity.Get(defaultVehicle.Value);
}
var defaultLocale = o.Get(_dLocale);
if (defaultLocale.NotNull()) {
session.UserLocale = new Locale(defaultLocale.Value);
}
} else {
Log.Info("Login: No preferences for driver {0} stored.", session.UserId);
}
result.SessionToken = CryptServices.Encode(session);
onResult(result);
}, e => {
Log.Warn("Login: Error processing preference request {0}", e);
result.SessionToken = CryptServices.Encode(session);
onResult(result);
});
} else {
onResult(result);
}
}
示例2: PerformLogin
IEnumerator PerformLogin(string username, string password){
loginStatus = LoginStatus.LoggingIn;
WWWForm loginForm = new WWWForm();
loginForm.AddField("username", username);
loginForm.AddField("unity", 1);
loginForm.AddField("password", password);
loginForm.AddField("submitted", 1);
WWW www = new WWW( LOGIN_URL, loginForm );
yield return www;
if(www.error != null){
Debug.Log("ERROR ON LOGIN: "+ www.error);
}
else{
string encodedString = www.data;
Debug.Log(encodedString);
JSONObject j = new JSONObject(encodedString);
// Debug.Log(j.list);
// Debug.Log(j.HasField("id_u"));
if(j.HasField("id_u")){
string uID = j.GetField("id_u").str;
userID = int.Parse(uID);
Debug.Log("User "+ userID + " has logged In");
loginStatus = LoginStatus.LoggedIn;
}
}
yield return 0;
}
示例3: LoginHandler
/// <summary>
/// Initialize everything that needs to be initialized once we're logged in.
/// </summary>
/// <param name="login">The status of the login</param>
/// <param name="message">Error message on failure, MOTD on success.</param>
public void LoginHandler(LoginStatus login, string message)
{
if (login == LoginStatus.Success)
{
// Start in the inventory root folder.
CurrentDirectory = Inventory.Store.RootFolder;
}
}
示例4: SendLoginNotification
public static void SendLoginNotification(LoginStatus loginStatus, Connection connection)
{
if (loginStatus == LoginStatus.Sucess)
{
// We should check for a exact number of nodes here when we have the needed infraestructure
if (ConnectionManager.NodesCount > 0)
{
connection.NodeID = ConnectionManager.RandomNode;
AuthenticationRsp rsp = new AuthenticationRsp();
// String "None" marshaled
byte[] func_marshaled_code = new byte[] { 0x74, 0x04, 0x00, 0x00, 0x00, 0x4E, 0x6F, 0x6E, 0x65 };
rsp.serverChallenge = "";
rsp.func_marshaled_code = func_marshaled_code;
rsp.verification = false;
rsp.cluster_usercount = ConnectionManager.ClientsCount + 1; // We're not in the list yet
rsp.proxy_nodeid = connection.NodeID;
rsp.user_logonqueueposition = 1;
rsp.challenge_responsehash = "55087";
rsp.macho_version = Common.Constants.Game.machoVersion;
rsp.boot_version = Common.Constants.Game.version;
rsp.boot_build = Common.Constants.Game.build;
rsp.boot_codename = Common.Constants.Game.codename;
rsp.boot_region = Common.Constants.Game.region;
// Setup session
connection.Session.SetString("address", connection.Address);
connection.Session.SetString("languageID", connection.LanguageID);
connection.Session.SetInt("userType", Common.Constants.AccountType.User);
connection.Session.SetLong("userid", connection.AccountID);
connection.Session.SetLong("role", connection.Role);
// Update the connection, so it gets added to the clients correctly
ConnectionManager.UpdateConnection(connection);
connection.Send(rsp.Encode());
}
else
{
// Pretty funny, "AutClusterStarting" maybe they mean "AuthClusterStarting"
GPSTransportClosed ex = new GPSTransportClosed("AutClusterStarting");
connection.Send(ex.Encode());
Log.Trace("Client", "Rejected by server; cluster is starting");
connection.EndConnection();
}
}
else if (loginStatus == LoginStatus.Failed)
{
GPSTransportClosed ex = new GPSTransportClosed("LoginAuthFailed");
connection.Send(ex.Encode());
connection.EndConnection();
}
}
示例5: UpdateFacebookId
async private void UpdateFacebookId(LoginStatus status)
{
if (status == LoginStatus.LoggedIn)
{
await PreloadUserInformation();
}
this.LoadPicture();
}
示例6: Start
void Start() {
Debug.Log("LoginScene Start");
//init
status = LoginStatus.WAIT;
controller = ClientController.Instance;
addListener();
Log.game.Debug("Game Started");
}
示例7: Login_Finish
public static void Login_Finish(User user, LoginStatus status)
{
if (status == LoginStatus.Success)
{
Contract.usersLoggedIn = Contract.usersLoggedIn.Add(user);
}
else // if status == LoginStatus.Failure
if (Contract.usersLoggedIn.Contains(user))
Contract.usersLoggedIn = Contract.usersLoggedIn.Remove(user);
activeLoginRequests = activeLoginRequests.RemoveKey(user);
}
示例8: LoginHandler
/// <summary>
/// Initialize everything that needs to be initialized once we're logged in.
/// </summary>
/// <param name="login">The status of the login</param>
/// <param name="message">Error message on failure, MOTD on success.</param>
public void LoginHandler(LoginStatus login, string message)
{
if (login == LoginStatus.Success)
{
// Create the stores:
InventoryStore = new Inventory(Inventory, Inventory.InventorySkeleton);
LibraryStore = new Inventory(Inventory, Inventory.LibrarySkeleton);
// Start in the inventory root folder:
CurrentDirectory = InventoryStore.RootFolder;
}
}
示例9: Network_OnLogin
void Network_OnLogin(LoginStatus login, string message)
{
if (login == LoginStatus.Failed)
{
Display.Error(Session.SessionNumber, "Login failed (" + message + ")");
}
else if (login == LoginStatus.Success)
{
Display.InfoResponse(Session.SessionNumber, "Connected!");
}
else Display.InfoResponse(Session.SessionNumber, message);
}
示例10: Network_OnLogin
private void Network_OnLogin(LoginStatus login, string message)
{
if (login == LoginStatus.Success)
{
UpdateTimer.Elapsed += new System.Timers.ElapsedEventHandler(UpdateTimer_Elapsed);
UpdateTimer.Start();
}
else if (login == LoginStatus.Failed)
{
Console.WriteLine("Login failed: " + Client.Network.LoginMessage);
Console.ReadKey();
this.Close();
return;
}
}
示例11: Network_OnLogin
private void Network_OnLogin(LoginStatus login, string message)
{
if (login == LoginStatus.Success)
{
EnablePlugins(true);
}
else if (login == LoginStatus.Failed)
{
BeginInvoke(
(MethodInvoker)delegate()
{
MessageBox.Show(this, String.Format("Error logging in ({0}): {1}",
Client.Network.LoginErrorKey, Client.Network.LoginMessage));
cmdConnect.Text = "Connect";
txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true;
EnablePlugins(false);
});
}
}
示例12: Login
public void Login(LoginData data, out string token, out LoginStatus status)
{
Smmuser user= SqlMapHelper.DefaultSqlMap.QueryForObject<Smmuser>("SelectSmmuserByKey", data.UserNumber);
if (user == null)
status = LoginStatus.InvalidUser;
else {
if (MainDataModule.Decrypt(user.Password) == data.Password)
status = LoginStatus.OK;
else
status = LoginStatus.InvalidPassword;
}
token = string.Empty;
if (status == LoginStatus.OK) {
token = Guid.NewGuid().ToString();
UserStateSingleton.Instance.AddUser(new UserInfo(token, data.UserNumber));
}
}
示例13: TryGetAuthenticatedLogin
public static bool TryGetAuthenticatedLogin(CSSDataContext db, string username, string password, out Login login, out LoginStatus loginStatus)
{
loginStatus = LoginStatus.Authenticated;
login = Login.FindLoginByUsernameOrCallsign(db, username);
if (login == null)
loginStatus = LoginStatus.InvalidCredentials;
else if (login.IsBanned)
loginStatus = LoginStatus.AccountLocked;
else
{
CssMembershipProvider provider = new CssMembershipProvider();
if (provider.ValidateUser(login.Username, password) == false)
loginStatus = LoginStatus.InvalidCredentials;
else
loginStatus = LoginStatus.Authenticated;
}
return loginStatus == LoginStatus.Authenticated;
}
示例14: LogHistory
private async Task LogHistory(LoginType loginType, LoginStatus status, string clientId, string username, string deviceKey, string apiKey, string clientIp = null, string clientUri = null)
{
var unityContainer = UnityConfig.GetConfiguredContainer() as UnityContainer;
var loginHistoryBll = unityContainer.Resolve<ILoginHistoryBll>();
if (string.IsNullOrEmpty(clientIp))
clientIp =SecurityUtils.GetClientIPAddress();
if (string.IsNullOrEmpty(clientUri) && HttpContext.Current != null)
clientUri = HttpContext.Current.Request.Url.AbsoluteUri;
int num = await loginHistoryBll.InsertLoginHistory(new InsertLoginHistoryInput()
{
Type = loginType.GetHashCode(),
UserName = username,
LoginTime = DateTime.Now,
LoginStatus = status.GetHashCode(),
AppId = string.IsNullOrEmpty(clientId) ? null : clientId,
ClientUri = clientUri,
ClientIP = clientIp,
ClientUA = HttpContext.Current.Request.UserAgent,
ClientApiKey = apiKey,
ClientDevice = deviceKey
});
}
示例15: OnGUI
void OnGUI() {
GUI.Box(CenterRect(0, -80, 300, 50), "유니티클라+자바서버 샘플");
GUI.Box(CenterRect(0, -30, 300, 25), mesage);
email = GUI.TextField(CenterRect(0, 0, 150, 25), email, 30);
password = GUI.TextField(CenterRect(0, 25, 150, 25), password, 30);
//로그인 버튼 클릭시 처리 프로토콜 호출
if( GUI.Button(CenterRect(0, 55, 50, 25), "login") ) {
PUserLogin login = new PUserLogin();
login.sendLogin(email, password);
}
//로그인 상태 변경
if( status == LoginStatus.SUCESS ) {
Application.LoadLevel("LobbyScene");
}else if( status == LoginStatus.FAIL ) {
mesage = "이메일 또는 패스워드가 맞지 않습니다.";
status = LoginStatus.WAIT;
}else if( status == LoginStatus.DUPLICATE_LOGIN ) {
mesage = "중복 로그인으로 인한 실패";
status = LoginStatus.WAIT;
}
}