Example #1
0
 public static LoginStatus succeed(user verifiedUser)
 {
     LoginStatus result = new LoginStatus();
     result.isLogined = true;
     result.status = STATUS_SUCCEED;
     result.loginUser = verifiedUser;
     return result;
 }
Example #2
0
 public static LoginStatus paswordWasExpired(user verifiedUser)
 {
     LoginStatus result = new LoginStatus();
     result.isLogined = true;
     result.status = STATUS_PASSWORD_WAS_EXPIRED;
     result.loginUser = verifiedUser;
     return result;
 }
Example #3
0
        public LoginStatus loginUser(user verifyUser)
        {
            LoginInfoDAL loginInfoDAL = LoginInfoDAL.getInstance();
            logininfo loginInfo = loginInfoDAL.selectSingle(verifyUser);

            if (loginInfo == null) {
                return LoginStatus.userDoesNotExist();
            }

            if (loginInfo.lockedout==true) {
            //    log(verifyUser.userId
            //        + " "
            //        + "lockedout ");

                return LoginStatus.accountIsLocked();
            }

            UserDAL userDal = UserDAL.getInstance();
            user loginUser = userDal.findByIdAndPassword(verifyUser);

            if (loginUser == null)
            {

            //    loginInfoUpdateLogic.doUpdateForWrongPassword(loginInfo);

            //    log(verifyUser.userId
            //        + " "
            //        + "login failure"
            //        + "number of password provided:"
            //        + loginInfo.cumulativeFailures);

                return LoginStatus.wrongPassword();
            }

            //log(user.userId
            //    + " "
            //    + "login success "
            //    + "number of password provided:"
            //    + user.loginInfo.cumulativeFailures);

            //loginInfoUpdateLogic.doUpdateForCumulativeFailuresReset(user.loginInfo);
            //user.password = null;

            //UserSessionHelper.save(session, user);

            //final Boolean needPasswordChange = userFindLogic
            //                                                .loginExpirationVerify(user);
            //if (needPasswordChange) {
            //    return LoginStatus.paswordWasExpired(user);
            //}

            return LoginStatus.succeed(loginUser);
        }
Example #4
0
        public logininfo selectSingle(user findItem)
        {
            logininfo selectedItem = db.logininfoes.SingleOrDefault(item => item.user_userid == findItem.userid);

            return selectedItem;
        }