check if username already exists in the database while user is entering values in PEGA - 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.

Related

How to ensure that the username that is auto-populated does not get replaced by another one in InfoPath

I have an approve and reject form having three views. In the first view i.e the requester's view I auto-populate the requester name by using "GetUserProfileByName". Now I also want to auto populate the name of the user who approves the form in a different view (but this view also has the requester's name)- so I was wondering if I actually use "GetUserProfileByName" again won't it change the first name too (i.e the requester's name). I don't have other accounts to test it out.
Can someone please provide a workaround to this problem
So basically I want this to happen:- For example when John enters the form his name should be auto populated in the requester's name field. And once this form is send to Michelle who approves it - the approver's name field should have been autopopulated with Michelle's name.
How can I avoid overwriting of data.
Thank you for helping
Add fields to the form data source to store the data returned from GetUserProfileByName service. Do not use default values for the values in these fields. Instead, I generally use form load rules for this - run the query, and then, if the requester field is blank, set the field to the user's name from the datasource.
When the approved view is submitted, you can take a similar approach with the approver name field - if it is blank, set it.

Where is password reset link stored in wordpress database

If you use Wordpress's built in password reset service it will go something like this:
Click forgot password
Enter your email or username
Receive a link in your email inbox
Click the link
Fill out form
That link you click, will look something like this:
http://yourdomain/wp-login.php?action=rp&key=vqwwSPzf6OK6bUv42XPk&login=natelough
If you try to change the &login to another name, it will reject you.
So, somewhere that 'key' is being stored in some way, and compared.
Where is it stored in the database?
I did an export of the database and searched the db for that string. It returned no results.
So what gives?
That key is generated by hashing a random string. You can see how this key is generated in the WordPress developer reference.
To answer your specific question, when a key is generated it is stored in the users table in the user_activation_key column. Only the most recently generated key is stored (invalidating previous reset keys). The key is also removed from the database once it has been used.
If you are looking to send these keys programmatically, you can generate them when you need them using get_password_reset_key(). That function accepts a WP_User object as its argument.
Depending on what you are trying to accomplish, there may be a more "best practices" way to do it than accessing that function directly.
The password is stored as a hash of the login name and password. You will find it in the users table under user_pass as an incomprehensible string. If the login name is changed, the entered password hashed with the login name will not match the string found in the database where the password was hashed with the original login name.

Membership and SQL question

I am thinking of following what buttons the user has pressed. I intend to choose the CreateUserWizard control that will create a database for me. The Membership class has got a few functions to identify who the user is..e.g. GetUserNameByEmail..
What i am trying to do, is to track what each user has pressed and use his input for sqlCommand.
For example, when the user presses the "post response" button, i want to record his identity and use it in sql to insert his message and identity..
The problem is that in the Users table that i made it has UserID as a primary key that identifies the user..and in the CreateUserWizard database or Membership cookie, it has its own functions fields.
So the question is how do i SELECT the users identity from the database/cookie created to me, and incorporate it into a statement in the SQL for my sqlStatement..
I need to obtain the identity of the user and use it in an SQL statement.. How can i achieve that?
You can grab the user_id from the Membership provider...
for example:
System.Web.Security.Membership.GetUser().ProviderUserKey
the will give you the user id of the current user - and you can use that value in your sql statement. If you're using the default Membership provider - this value will be a unique identifier (Guid) so:
Guid currentUserId = new Guid(System.Web.Security.Membership.GetUser().ProviderUserKey.ToString());

ASP.Net: How to log login-trys correctly?

I have a login in my admin page.
Now I want to log every login-try in my database.
Normaly I have a Log-table with the adminID in a foreign key of the adminuser-table.
Now, of course, when someone try to login with a username that doesn't exist, I haven't a ID and the foraign-key uses a crash in the write-attamp.
Now whats the correct way to log a login-try when the username isn't correct and you haven't the correct id?
1) Add a second log-table for such things
or 2) Remove the foraign Key in the first log-table
Why not just have the adminID field as a nullable field? That way, you could distinguish between successful and unsuccessful login attempts.

send a mail to a user with a link

In my project i am sending a mail to the user to create a user account. I want to enable that link for the first time he/she clicks the link. if he clicks the link for more than 2 times,then it should go to custom error page.how to do this?
This depends on how the link is generated.
For example: If your link contains a username as GET-parameter, then you could simply query your database if the username is already in use. I would advise against that, because the user can easily change that GET-Parameter
I would recommend this: Your link should contain a unique identifier, most likly a hash. This hash is stored somewhere, to garantee it's uniqueness, like in the usertable of your database (a column for the hash of the registration link). That might also come handy, because you could create new user rows and already prefill them with necessary information. You could use these information upon rendering to insert text into the textboxes

Resources