username() does not always evaluate in infopath - infopath

I have a testbox in my infopath form which is set to open in a browser. The value of the textbox is set to the username() formula.
When I create a new form, the username() formula evaluates to the logged in's username, but the textbox is blank when an existing form is opened. This is fine, but should I expect the same behavior when the formula username() is used in a conditional statement?

Check the Textbox properties whether the
"Update this value when the result of
the formula is reclaculated"
check box has been ticked. this should mean that the username will be updated when the form is opened by other people. as for the conditional statement I would expect the the Username to return the username when ever it is recacluated.
Also note that the Username depends on the security set up of you form.
Have a look at UserName Property to verify the security requirements against the Microsoft Documentation.

Related

User Picker to field values

Sorry if this is too basic for this site, but app maker help directed me here. I am creating a data entry screen that includes basic info for a user - name, email, phone, etc. I am using the user picker to select the individual from our Directory. How do I pass all of the needed Directory field values of the selected user to my insert record screen. I am checking the valueisRecord box on the user picker, but can't figure out how to assign the selected user's info to the form's value fields. Thanks for the help.
Ok, your last comment makes sense. But please, to avoid going back and forth, I encourage you to formultae your question properly by including all the information that could be required. Now, moving on to your problem...
The reason you are getting that error is because you are binding the UserPicker widget value to the datasource email field. Remember, the UserPicker value is an object, not a string.
To fix your problem, remove the binding of the value from the UserPicker. Then for the onValueChange change event of the UserPicker please add the following:
var fullName = newValue.FullName;
var email = newValue.PrimaryEmail;
widget.datasource.item.Name = fullName
widget.datasource.item.email = email;
That way, you don't assing an object to the email field but instead a plain string.

check if username already exists in the database while user is entering values in PEGA

check if username already exists in the database while user is entering values in that particular field(username)in PEGA?
I can give you a hint...
Refresh the Section on Change of the input field and apply an Activity which will do Obj-Browse in the table to check whether the User is present in the table or not.
If User is not present in table then set error message through Page-Set-Message method on the primary page.

How to hash a password and save into a database table?

I have a form register.aspx and a login function and I am using vb.net
In my register.aspx I have two textboxes, for user name and password and a submit button. If the user click's on the submit button, the password will be hashed and stored with the username in the database table called Customer
I would like to know-
1) How to hash a password?
2) How to compare the hashed value in database with the password entered in the textbox while login?
To answer your questions in order.
You simply use one of the crypto classes, following the documentaion.
You store the hashed value in the database, so when you query the database, you use the hash.
Psuedo code:
Function GetUser(name, password)
hashedPassword = Hash(password)
sqlcmd = 'select userkey from user where username = #name and password = #pass'
add cmd parameter ('#name', name)
add cmd parameter ('#pass', hashedPassword)
userKey = cmd.executequry
Return userkey
End Function
That said, don't do this if you can implement OpenID instead. The world really doesn't need another site where you have to remember or share a password for no good reason.
You may use FormsAuthentication.HashPasswordForStoringInConfigFile static method (System.Web.Security namespace).
Dim plain="abc"
Dim hash= FormsAuthentication.HashPasswordForStoringInConfigFile(plain, "MD5")

test case format for login page contains 2 fields only

What is the format of writing the test case documentation for login page which contains only userid and password field and for birth form?
Give the Username as string in the User name field, which is of maximum .
Provide the relevant Password, after giving the password if click on submit button and if the password and username matches for a particular user then the application allows the user to login or else gives an error message.

Crystal report (required field validation)

Im using asp.net crystal report(not in crystal report XI)
i just create parameter field datatype(string) and add some default values from the table
If user didint select any value and press submit then nothing record(s) has been fetched...
so if user press submit without selecting any record i have to show message to user to select records...(required field validate)
how in crystal report?
Are you strictly relying on CR's parameter prompt, or are you prompting for the parameter yourself on a form you created?
You really should be checking the value the user selects within your ASP.NET code before passing it on to the report. Besides simply checking to see if the user chose something, this way you could check for other problems in the user input before passing the data on to your report.

Resources