本文整理汇总了C#中Login类的典型用法代码示例。如果您正苦于以下问题:C# Login类的具体用法?C# Login怎么用?C# Login使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Login类属于命名空间,在下文中一共展示了Login类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLoginByLoginName
public static Login GetLoginByLoginName(string loginName)
{
Login login = new Login();
SqlLoginProvider sqlLoginProvider = new SqlLoginProvider();
login = sqlLoginProvider.GetLoginByLoginName(loginName);
return login;
}
示例2: Loaded_Method
private void Loaded_Method()
{
Login login = new Login();
LoginViewModel lvm = new LoginViewModel();
login.DataContext = lvm;
login.ShowDialog();
try
{
LoginAccount = lvm.Account;
AccountName = lvm.Account.AccountName;
MainModel.MainAccount = lvm.Account;
AccountPhoto AccountPhotoView = new AccountPhoto(MainFrame);
AccountPhotoModelView AccountPhotoModelView = new AccountPhotoModelView(MainModel.MainAccount, MainFrame);
AccountPhotoView.DataContext = AccountPhotoModelView;
MainFrame.NavigationService.Navigate(AccountPhotoView, UriKind.Relative);
SearhcEnable = true;
MainFrame.NavigationService.RemoveBackEntry();
while (MainFrame.CanGoBack)
{
MainFrame.RemoveBackEntry();
}
}
catch (NullReferenceException)
{
AccountName = "Нажмите чтобы войти";
SearhcEnable = false;
MainModel.MainAccount = null;
while (MainFrame.CanGoBack)
{
MainFrame.RemoveBackEntry();
}
}
}
示例3: CheckUser
public static Tecnico CheckUser(Login pLogin)
{
try
{
StringBuilder sql = new StringBuilder();
Tecnico tecnico = new Tecnico();
sql.Append("SELECT * ");
sql.Append("FROM Tecnico ");
sql.Append("WHERE Nome='" + pLogin.Nome + "' and Senha='" + pLogin.Senha + "'");
SqlDataReader dr = SqlConn.Get(sql.ToString());
while (dr.Read())
{
tecnico.IdTecnico = (int)dr["IdTecnico"];
tecnico.Nome = (string)dr["Nome"];
tecnico.Senha = (string)dr["Senha"];
}
return tecnico;
}
catch (Exception)
{
return null;
}
}
示例4: Parse
/// <summary>
/// converts the string to "Login" object
/// </summary>
/// <param name="str">the string. format : [username]_[password]</param>
/// <returns>the Login object</returns>
public static Login Parse(string str)
{
Login r = new Login();
r.username = str.Split('_')[0];
r.password = str.Split('_')[1];
return r;
}
示例5: LoginTest
public void LoginTest() {
var mth = new Login() {
UserName = "[email protected]",
Password = "aaabbbcc"
};
var a = ApiClient.Execute(mth).Result;
}
示例6: Index
public ActionResult Index(Login user)
{
if (ModelState.IsValid)
{
//var login = from user2 in db.Users
// where user2.UserName == user.Username && user2.Password == user.Password
// select user2;
//if (login.Count() == 1)
if(user.Username == "sing1205" && user.Password=="123456")
{
FormsAuthentication.SetAuthCookie(user.Username, false);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", "Invalid Username or Password");
}
}
return View();
}
示例7: Main
//private WebBrowser showwebpage;
public Main()
{
InitializeComponent();
//showwebpage = htmlTextBox1.Browser;
Welcome welcomedlg = new Welcome();
if (welcomedlg.ShowDialog() == DialogResult.OK)
{
Login logindlg = new Login();
if (logindlg.ShowDialog() == DialogResult.OK)
{
///////添加登录日志
}
else
{
this.Close();
//Application.Exit();
Environment.Exit(0);
}
}
InfoSource info = new InfoSource();
info.GetAllInfo();
InitTreeView();
InitTagsTree();
//InitRssSource();
//更新状态信息
UpdateManager.UpdateEvent += new UpdateManager.UpdateStatuHandler(UpdateManager_UpdateEvent);
UseUpdateConfig();
}
示例8: SecurityUserDetails
public SecurityUserDetails(User user, Login p)
{
parent = p;
InitializeComponent();
_user = user;
populateFormFromUser(user);
}
示例9: Login
public ActionResult Login( Login model, string returnUrl ) {
if ( !ModelState.IsValid ) {
return View( model );
} else {
return RedirectToLocal( "Error" );
}
}
示例10: LoginButtonClick
public async void LoginButtonClick(object sender, EventArgs e)
{
LoginPage.loginFail.IsVisible = false;
if (String.IsNullOrEmpty(LoginPage.username.Text) || String.IsNullOrEmpty(LoginPage.password.Text))
{
await DisplayAlert("Validation Error", "Username and Password are required", "Re-try");
} else {
//code here for check valid username and password from server
new System.Threading.Thread (new System.Threading.ThreadStart (() => {
Device.BeginInvokeOnMainThread (() => {
LoginPage.loginButton.IsEnabled = false;
LoginPage.activityIndicator.IsRunning = true;
});
})).Start();
Login loginData = new Login ();
loginData.lastConnectWebscoketUrl = LoginPage.websocketUrl.Text;
loginData.username = LoginPage.username.Text;
loginData.password = sha256_hash(LoginPage.password.Text);
loginData.flagForLogin = "";
loginData.node_command = "check_login";
//no await App.Database.Save_Login_Item (loginData.username, LoginPage.password.Text, "pass", loginData.lastConnectWebscoketUrl);
string jsonCommandLogin = JsonConvert.SerializeObject(loginData, Formatting.Indented);
System.Diagnostics.Debug.WriteLine ("jsonCommandLogin" , jsonCommandLogin);
WebsocketManager.websocketMaster.Send (jsonCommandLogin);
//WebsocketManager.websocketMaster.Send("{\"cmd_login\":[{\"username\":\"admin\",\"flagForLogin\":\"pass\",\"lastConnectWebscoketUrl\":\"ws://echo.websocket.org\"}]}");
// no ipm1.showMenuTabPage ();
}
}
示例11: Post
public LoginResponse Post(Login request)
{
AuthService authService = ResolveService<AuthService>();
authService.Post(new Auth {
provider = AuthService.CredentialsProvider,
UserName = request.UserName,
Password = request.Password
}) ;
IAuthSession session = this.GetSession();
//UserManager um = new UserManager(base.RequestContext, AuthRepoProxy);
//AuthorizationResponse aur = um.GetAuthorization(
// new GetAuthorization{UserId=int.Parse(session.UserAuthId)});
AuthorizationResponse aur= new AuthorizationResponse{Roles= GetFakeRoles()};
session.Permissions= aur.Permissions.ConvertAll(f=>f.Name);
session.Roles= aur.Roles.ConvertAll(f=>f.Name); //(from r in aur.Roles select r.Name).ToList();
authService.SaveSession(session);
return new LoginResponse(){
DisplayName= session.DisplayName.IsNullOrEmpty()? session.UserName: session.DisplayName,
Roles= aur.Roles,
Permissions= aur.Permissions
};
}
示例12: Index
public ActionResult Index(Login login)
{
// UserStore and UserManager manages data retreival.
UserStore<IdentityUser> userStore = new UserStore<IdentityUser>();
UserManager<IdentityUser> manager = new UserManager<IdentityUser>(userStore);
IdentityUser identityUser = manager.Find(login.UserName,
login.Password);
if (ModelState.IsValid)
{
if (identityUser != null)
{
IAuthenticationManager authenticationManager
= HttpContext.GetOwinContext().Authentication;
authenticationManager
.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var identity = new ClaimsIdentity(new[] {
new Claim(ClaimTypes.Name, login.UserName),
},
DefaultAuthenticationTypes.ApplicationCookie,
ClaimTypes.Name, ClaimTypes.Role);
// SignIn() accepts ClaimsIdentity and issues logged in cookie.
authenticationManager.SignIn(new AuthenticationProperties
{
IsPersistent = false
}, identity);
return RedirectToAction("SecureArea", "Home");
}
}
return View();
}
示例13: ProcessPackage
public async Task ProcessPackage(User user, Login package)
{
var users = (await mServer.BD.Find<UserInfo>(u => u.Name == package.Name)).ToArray();
var result = new Login();
if (!users.Any())
{
result.ID = Guid.Empty;
await mServer.ClientListener.Send(user, result);
return;
}
var foundUser = users.Single();
if (!BCrypt.Net.BCrypt.Verify(package.Password, foundUser.PasswordHash))
{
result.ID = Guid.Empty;
await mServer.ClientListener.Send(user, result);
return;
}
if (mServer.Lobby.Values.Any(u => u.Name == package.Name))
{
result.ID = Guid.Empty;
await mServer.ClientListener.Send(user, result);
return;
}
user.ID = foundUser.ID;
user.Name = foundUser.Name;
if (foundUser.RoomID != Guid.Empty && mServer.Rooms.ContainsKey(foundUser.RoomID))
user.Room = mServer.Rooms[foundUser.RoomID];
result.ID = foundUser.ID;
await mServer.ClientListener.Send(user, result);
}
示例14: button2_Click
private void button2_Click(object sender, EventArgs e)
{
string id = textBox1.Text.Trim();
string password = textBox2.Text.Trim();
string againPw = textBox3.Text.Trim();
if (id != "" && password != "" && againPw != "")
{
if (SqlAdmin.exitById(id))
{
MessageBox.Show("该用户名已经存在。");
return;
}
else if (password != againPw)
{
MessageBox.Show("请确保两段密码相同.");
}
else
{
Admin admin = new Admin(id,password);
SqlAdmin.addAdmin(admin);
MessageBox.Show("注册成功.");
Login loginView = new Login();
loginView.Show();
this.Dispose();
}
}
else
{
MessageBox.Show("该输入所有数据.");
}
}
示例15: Start
void Start()
{
Login.SetGameMachineApp(this);
login = gameObject.AddComponent<Login>() as Login;
login.SetLoginUi(this);
login.DoLogin();
}