webForumDet fria alternativet

Logga in mot server via ASP sida

ASP

1 svar · 245 visningar · startad av Fraggel

Medlem sedan sep. 2003301 inlägg
Frågan#1

Hur går jag tillväga var börjar jag ???

Mitt Problem

1. Kund skall logga in med sitt anv och lösen som finns reggade i AD på en win2k3 maskin.
2. I det läger om inloggningen är okej så skall det skickas en Engångskod till kundens mobil.
3. Den skall inom 10 min knappas in annars så termineras sessionen och kunden får börja om...

steg 2 pch 3 är lösta.
Jag hittar fan inte var jag skall börja läsa för att lyckas logga in mot domänen eller åtminstonde kolla om kontouppg stämmer eller inte.

Medlem sedan nov. 20017 144 inlägg
#2

Kan detta vara ngt?

if request("GETUSER") = "" Then
    ' write out the test form 
		With Response
		.write "<FORM ACTION=USER.ASP METHOD=POST>"
		.Write "<INPUT TYPE=TEXT NAME=oDomain>ENTER DOMAIN<BR>"
		.write "<INPUT TYPE=TEXT NAME=oUSer>ENTER USER NAME TO CHECK<BR>"
		.write "<INPUT TYPE=PASSWORD NAME=oPassword>ENTER USER PASSWORD<BR>"
		.Write "<INPUT TYPE =SUBMIT NAME=GETUSER VALUE=CHECK>"
		.write "</FORM>"
		end with
	
	else
   ' Form was autopostback, grab the form variables ...
		  oDomain= Request("oDomain")
		  oUser = Request("oUser")
		  oPassword = Request("oPassword")
' begin "Kludge" VBScript error trapping  (see Javascript version fortry / catch handling)
on error resume next
' Set reference to the ADSI interface to NT User Manager ...
Set objUser = GetObject("WinNT://" & oDomain & "/" & oUser )

	if err.number <> 0 then
		Response.write "Login Error---"
		Response.end
	end if
	If len(objUser.FullName) < 1 then
			response.write "User Not Found!!!!"
			response.end
	else

on error resume next
' We verify the user password by using the ChangePassword method to change 
' the password back to itself.
' Since this requires that first parameter password be correct, it's an easy
'  way to circumvent the fact
' that NT won't give actual access to the user's password to make a comparison. 
' Be aware that on some systems,
' Admin policy settings may force the password 
' to have to be changed after X number of uses
' of this method...

  objUser.ChangePassword  oPassword, oPassword
	if err.number <> 0 then

		Response.write" BAD PASSWORD!"
		Response.end
	else  
 

' Now write out the ADSI User object properties that are supported by Windows 2000 ...

With Response
    .write "USER AUHTENTICATED!<BR>"
	.write "Properties for user " & objUser.FullName & ": <BR>"
	.Write "AccountExpirationDate: " & objUser.AccountExpirationDate & "<BR>" 
	.Write "BadLoginCount: " & objUser.BadLoginCount & "<BR>"
	.write "Description: " & objUser.Description & "<BR>"
	.write "HomeDirectory: " & objUser.HomeDirectory & "<BR>"
	.write "IsAccountLocked: " & objUser.IsAccountLocked & "<BR>"
	.write "LastLogin: " & objUser.LastLogin & "<BR>"
	.write "LastLogoff: " & objUser.LastLogoff & "<BR>"
	.write "LoginHours: " & objUser.LoginHours & "<BR>"
	.write "LoginScript: " & objUser.LoginScript & "<BR>"
	.write "LoginWorkstations: " & objUser.LoginWorkstations & "<BR>"
	.write "MaxStorage: " & objUser.MaxStorage &"<BR>"
	.write "PasswordExpirationDate: " & objUser.PasswordExpirationDate & "<BR>"
	.write "PasswordMinimumLength: " & objUser.PasswordMinimumLength & "<BR>"
	.write "PasswordRequired: " & objUser.PasswordRequired & "<BR>" 
	.write "Profile: " & objUser.Profile & "<BR>"
    .write "Account Disabled: " & objUser.AccountDisabled
end with
	
end if	

end if

end if
278 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
134 ms — deklarationer (db)
0 ms — hämta statistik (cache)
139 ms — hämta tråd, inlägg och bilagor (db)
136 ms — ändringar (db)