//Sprawdzenie prawidlowosci sesji
 public static mUser logIn(String session)
 {
     if (Uta.CheckSession(session) == null || (int)Uta.CheckSession(session) == 0) return null;
     mUser logedIn = new mUser(session, (int)Uta.SessionUserId(session));
     logedIn.authorize();
     return logedIn;
 }
Example #2
0
 public static mUser disconnect(String session)
 {
     if ((int)Uta.CheckSession(session) == 0) return null;
     Uta.UserInactive(session);
     mUser loggedIn = new mUser(session, (int)Uta.SessionUserId(session));
     loggedIn.authorize();
     return loggedIn;
 }
 //Logowanie, uzyskanie nowej sesji
 public static mUser logIn(String login, String password)
 {
     var userid = Uta.UserLogIn(login, password);
     if (userid == null) return null;
     mUser user = new mUser(login, password, (int)userid);
     user.authorize();
     String guid = Guid.NewGuid()+"";
     user.setSession(guid);
     Uta.NewSession(guid, userid);
     return user;
 }
 //Rejestracja uzytkownika
 public static mUser register(String name, String surname, String login, String password)
 {
     //Mozna dodac jeszcze jakies warunki dotyczace hasla
     int userid = -1;
     if(Uta.LoginExists(login)==1) return null;
     mUser newUser=new mUser(name, surname, login, password);
     newUser.authorize();
     String guid = Guid.NewGuid() + "";
     newUser.setSession(guid);
     userid = Uta.NewUser(name, surname, login, password, guid);
     Uta.NewSession(guid, userid);
     return newUser;
 }
Example #5
0
        //Rejestracja uzytkownika
        public static mUser register(String name, String login, String password)
        {
            //Mozna dodac jeszcze jakies warunki dotyczace hasla
            int userid = -1;
            int message = 0;
            if ((int)Uta.LoginExists(login) > 0)
            {
                message -= 5;
                if ((int)Uta.NameExists(name) == 1) message -= 3;
                mUser taken = new mUser("", message);
                return taken;
            }
            if ((int)Uta.NameExists(name) > 0)
            {
                message -= 3;
                mUser taken = new mUser("", message);
                return taken;
            }

            String guid;
            do
            {
                guid = Guid.NewGuid() + "";
            }
            while ((int)Uta.CheckSession(guid) != 0);
            userid = (int)Uta.NewUser(name, login, password, guid);

            mUser newUser=new mUser(userid,name, login, password,guid);
            newUser.authorize();
            return newUser;
        }
Example #6
0
 //Wylogowanie uzytkownika. Usuniecie tokena sesji i przelaczenie stanu aktywnosci na false
 public static mUser logOff(String session)
 {
     if ((int)Uta.CheckSession(session) == 0) return null;
     mUser loggedOff = new mUser(DBNull.Value.ToString(), (int)Uta.SessionUserId(session));
     Uta.NewSession(DBNull.Value.ToString(), false, loggedOff.getId());
     loggedOff.unauthorize();
     return loggedOff;
 }
Example #7
0
 //Logowanie, uzyskanie nowej sesji
 public static mUser logIn(String login, String password)
 {
     var userid = Uta.UserLogIn(login, password);
     if (userid == null) return null;
     mUser user = new mUser(login, password, (int)userid);
     user.authorize();
     String guid;
     do
     {
         guid = Guid.NewGuid() + "";
     }
     while ((int)Uta.CheckSession(guid) != 0);
     user.setSession(guid);
     //, getAccessDate(DateTime.Now)
     Uta.NewSession(guid, true,(int)userid);
     return user;
 }