Joomla - changing user data before sending activation email - events

Is it possible to change user data (username, name....) before activation email is sent to the user?
I want to use email as username, so I need to copy value of email field to the username field.
When I have used onUserAfterSave event I have been able to update username value to email value, but activation email is sent already before this event....
I have tried to use onUserBeforeSave event but without success....
Thanks for help!

So why dont you store e-mail as user name directly on onuserbeforesave events or similar event. So that you don't need update table & i think activation email will directly get email as user name.

Related

Cognito - How to give users Log in with both Email and Phone number

I have cognito set up to allow both email addresses and phone numbers. Here is the the scenerio.
Sign up User A with email test#test.com and auto verify the email using CognitoIdentityServiceProvider#signup with username : test#test.com and UserAttributes for the email address.
Update the users account with a phone number 123-456-7899 and auto verify the phone number
Attempt to login with 123-456-7899
Instead of logging in user A which currently has a verified phone number of 123-456-7899 it creates user B
Is there any way to let users have unique phone numbers and emails and be able to login in with both? Or does the signup always go based on the initial username?
It looks like your user pool is configured with UsernameAttributes and you chose both email and phone_number to act as the username. I agree that the behaviour is quite strange and you can end up with two different users, both having exactly the same email and phone number, both attributes verified.
Have you tried configuring the user pool with UsernameAliases? It allows you to specify 3 attributes (email, phone_number, preferred_username) that will act as username aliases and the users will be able to log in with any of them (assuming that they're verified). The caveat is that they won't be able to authenticate with the email address immediately after signing up as it needs to be verified first.
you need to choose this option while setting up cognito user pools
Users can use a username and optionally multiple alternatives to sign up and sign in. Here you can allow users to sign in by email and sign in with a phone number.
Please note email & phone number both should be verified.
Here how you can login with both email/username:
Cognito With Lambda Function:
Make sure you enable both username and email options when creating a users pool:
if you want to log in with email, verify the user email with pre-signup lambda functions, or through the email verification code sent to them, and then verify their email address with lambda functions.
Verify email address through pre-signup lambda trigger :
exports.handler = (event, context, callback) => {
event.response.autoConfirmUser = true;
event.response.autoVerifyEmail = true;
context.done(null, event);
};
in your pre-signup lambda trigger.
if the email is not verified and you are trying to log in with the email you will get the error.
Email should be verified like in the image below:

How to reset password for logged out user

I'm using Parse javascript API. If a user has logged out, I will not have a 'currentUser'. Therefore, when I try to use the Parse.User.requestPasswordReset call, it will not work. Is there another way to offer users a way to reset their password if they have been logged out? It seems strange that having a currentUser is required.
It isn't required. You don't say why you think it is, but only an e-mail address is required in order to request a reset (as the result is an e-mail being sent to the user). It's normal to simply have the user type their e-mail address in to trigger the reset logic. Indeed if the user was logged in you would need to be careful about allowing e-mail address editing and then password reset selection...

How to Reset Password for User with Unverified (and possibly incorrect) Email on Parse.com?

When a user initially signs up through my app on Parse.com, they supply a username, an email address, and a password.
They verify that email address before they can start using the Parse.com functionalities. So now the user has a valid username, email address and password.
Then, consider this scenario:
1) The user changes his or her email address. 2) The user fails to validate the new email address. 3) The user doesn't use the app for a while. 4) The user forgets his or her password. 5) The user asks to reset the password.
If the user used his or her old email address for the password reset, that address is now gone and the user won't be able to reset the password using that email address.
If the user used the new email address, that address is not verified. Furthermore, it might not have been verified because it could have been typed in wrongly. So the user won't be able to reset the password using that email address.
How is this supposed to have gone down? Is there any way to keep the old email address until the new email address has been verified? That is the only way I can see that this would work.
Have you tried to use the Trigger features from Parse CloudCode?
https://parse.com/docs/cloudcode/guide#cloud-code-aftersave-triggers
Here you can perform code before or after some Object changing. So you can do what you suggested in the bottom of your question: save in another field de old email when the email or emailVerified fields changes.

Can an admin validate sign-up requests in Parse.com?

Is there something similar to the email verifcation feature where a system admin could validate user sign-up/registration requests?
Background: We're building a system with a closed community, where new users can join only if an admin has verified their sing-up data.
Ideally the admin should just receive an email that there's a new registration request and validate the request directly from the email.
The emailVerified column is protected - it can only be updated by the system in response to the target user clicking the link in the validation email.
An admin can not "tick" this field on behalf of another user.
However. From your brief description of the background I would suggest that you want the users to click the link - after all it serves to validate their email address. If you are creating your own app there is nothing to stop you adding your own column to the user model (or preferably a related table) and implement code in your sign up that also checks this extra column. Of course this is more work - but likely not excessive - and you get the desired workflow.

How to disable Joomla Unique Email Functionality?

I have a site with Joomla 1.5.25. I have user login facilty with the site. I have modified Joomla's default functionality. Also I have created a user acount via php MyAdmin and entered so many data approximatly 1200 user entry.
But now I face a problem with the Email at Joomla backend.
When I trying to changed the Email ID via the back-end(user managment), its fires an error that:
"Email Id alread in used."
So here I want to change this Unique Email validation and it allow me to enter the Email ID if its already used by other one. Is ther any way or patch to set it disable?
Thanks!
There is no "easy" solution to work with duplicated emails.
But if you really need to do it, you have to override JTableUser (see line 230) and take care of sideffects like the ability to reset a password on com_users.

Resources