Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CUser u = StaticLocalDB.GetUserbyMail(userName.Value); //nalezeni uzivatele
- if (FormsAuthentication.Authenticate(userName.Value, pwd.Value))//autentikace pro adminy z webconfigu
- {
- u.LogIn();//nastaveni posledniho prihleseni
- FormsAuthentication.RedirectFromLoginPage(userName.Value, true);
- Response.Redirect("Admin/users.aspx");
- }
- else if (u != null && u.Pwd == pwd.Value)//autentikace uzivatelu registrovanych
- {
- FormsAuthentication.SetAuthCookie(u.Email, true);//prihlaseni
- u.LogIn();//nastaveni posledniho prihleseni
- Response.Redirect("User/main.aspx");
- }
- else
- {
- errorLogin.Text = "Špatná kombinace";
- }
- public partial class IDCard : System.Web.UI.UserControl
- {
- CUser curent;
- protected void Page_Load(object sender, EventArgs e)
- {
- //ziskani aktualniho uzivatele
- curent = StaticLocalDB.GetUserbyMail(HttpContext.Current.User.Identity.Name);
- if (curent != null)//pokud je prihlaseeny
- {
- //ziskam udaje
- name.Text = curent.ToString();
- time.Text = curent.Loged.ToString();
- }
- }
- protected void LogOut_Click(object sender, EventArgs e)
- {
- //odhlaseni
- FormsAuthentication.SignOut();
- Response.Redirect("/Default.aspx");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement