How can I add User Profile(City and Country) details to the account activation email? Currently I am getting the default joomla message.
Name :
email:
Username:
I would like to add City, Country to the Email body of the message. I appreciate any suggestions.
In Registration Controller and model you can see corresponding functions for saving user data and the email triggering section.
On the registration controller a function name with register() calls the model contain register().
Inside the model register() is handling the activation email content you can add or remove details from there.
The file path is components/com_users/controllers/registration.php and model
registration components/com_users/models/registration.php
hope its helps..
Related
So I'm currently in an attempt to make my own account verification system and I'm using some parts of Djoser as a reference. let me try to walk you to my question
Let's say you're to make a new account in Djoser app
you put in the information of your soon to be made account including email
submit the form to the backend
get an email to the whatever email account you put in earlier to verify your account
click the link in your email
get to the verify account page
now in this page there's a button to submit a UID and a token and both of those information lies in the URL.
My question is:
What are those tokens? is it JWT?
How do they work?
How can I implement that in my own projects without djoser?
The answers to your questions are immersed in the own code of djoser.
You can check djoser.email file and in the classes there, they are few methods get_context_data().
def get_context_data(self):
context = super().get_context_data()
user = context.get("user")
context["uid"] = utils.encode_uid(user.pk)
context["token"] = default_token_generator.make_token(user)
context["url"] = settings.ACTIVATION_URL.format(**context)
return context
So get the context in the class where is instance, and in this context add the 'uid' (this is basically str(pk) and coded in base64, check encode_uid()), the 'token' (just a random string created with a Django function from your Secret key; you can change the algorithm of that function and the duration of this token with PASSWORD_RESET_TIMEOUT setting) to use temporary links, and finally the URL according the action which is performed (in this case the email activation).
Other point to consider is in each of this classes has template assigned and you can override it.
Now, in the views, specifically in UserViewSet and its actions perform_create(), perform_update() and resend_activation(), if the Djoser setting SEND_ACTIVATION_EMAIL is True, call to ActivationEmail to send an email to the user address.
def perform_create(self, serializer):
user = serializer.save()
signals.user_registered.send(
sender=self.__class__, user=user, request=self.request
)
context = {"user": user}
to = [get_user_email(user)]
if settings.SEND_ACTIVATION_EMAIL:
settings.EMAIL.activation(self.request, context).send(to)
...
The email is sent and when a user click the link, whether the token is still valid and uid match (djoser.UidAndTokenSerializer), the action activation() of the same View is executed. Change the user flag 'is_active' to True and it may sent another email to confirm the activation.
If you want code your own version, as you can see, you only have to create a random token, generate some uid to identify the user in the way that you prefer. Code a pair of views that send emails with templates that permit the activation.
I want to get the userlogin and city attribute details of the (requester) logged in user raising the request in OIM.
I want to process the validation according to certain attributes of requester city attribute.
You can make use of oracle.iam.platform.context.ContextManager class and call various methods available with it.
e.g. ContextManager.getOrigUser(); should give you requester's login.
Currently using Joomlashine JSN Uniforms on a beta site. I need to send a duplicate submission to another email address. However, JSN Uniforms canot do this ATM, but there is Script section in form admin panel which includes
Custom Scripts (PHP) called on form processing
The $html string contains the HTML code of the form. You can modify it by adding a PHP script below. Remember to not include the tags.
On form Process
The $post variable contains $_POST data of the form. You can modify it by adding a PHP script below, before it is added to the database. Remember to not include the tags.
After form has been processed
The $post variable contains $_POST data of the form. You can modify it by adding a PHP script below, after form been processed successfully. Remember to not include the tags.
Form Setup
Name
email
subject
department (pulldown) 1. Sales & Service 2. Training & Standards
Message
send
Department: Sales & Service has 2 email addresses (at the moment Uniforms can only assign 1 email address
user1#company.com
user2#companny.com
is there a script I can use to have the submitted form send to the Department user2#company.com and have the form sent to user1#company.com
problem resolved by not messing around with Joomla but adjusting the email service to forward/alias to one address and simply setup Outlook client for each use for the primary email address
Magento: Based on certain customer data I need to send a copy of the confirmation email to other email addresses.
I created an observer to catch the order data
checkout_onepage_controller_success_action
In my observer class I load all data I need with
Mage::getModel('sales/order')->load($observer->getOrderIds());
That works like a charm.
Now some code is selecting the email address where the copy supposed to go to.
But how can I send a copy of the order confirmation email to (always different) email addresses?
$order->sendNewOrderEmail();
Above doesn’t work for me because I need the recipient as a parameter.
Any help will be much appreciated. Thank you.
The simplest way would be to create your own order class:
class My_Mymodule_Model_Sales_Order extends Mage_Sales_Model_Order {
public function sendNewOrderCustomEmail($email) {
// copy from parent's sendNewOrderEmail method with changed this line
// $emailInfo->addTo($this->getCustomerEmail(), $customerName);
}
}
And then in your event, use
Mage::getModel('mymodule/sales_order')
->load($order_id)
->sendNewOrderCustomEmail('myemail#...');
Magento takes emails from order data.
Try:
$order->setCustomerEmail("new#email.com");
$order->sendNewOrderEmail();
The scenario:
a User class has several groups of properties: password, address, preference, roles.
We need different Ajax calls to update the (1) user password, (2) user profile, (3) roles a user is in.
All the tutorials and examples only shows one POST action to update the whole User class. My question is how we can update only part of the class.
For example, when updating the user password, we will:
Display a text box to collect new password from user input.
Make an Ajax call that only POST the new password together with the userId (like: {id=3, newPassword=xxxxx}) to the WebAPI POST action.
That action will only update the password for the user.
One solution: (the easiest to think of)
Call the GET action with the userId to retrieve all the data for a user
Update the password in the user data with the values obtained from the web user input
Call the POST action with the updated data, which contains all properties in the User class.
That POST action will update the whole data without knowing only the password is changed.
The benefit: only one POST action is needed for the ApiController.
The shortcoming: we have to Ajax twice.
So, is it possible that we can have multiple POST actions in one ApiController? For example, PostPassword(userId, password), PostProfile(userId, profile) and PostRoles(userId, roles).
In this way, we will only call PostPassword to send the password to ApiController. In client side, there will be only one Ajax call. It is on the server where we will do the update. The benefit is of course the reduced data transferred over Internet.
If it is possible, what is the correct way to direct all different POST calls to their corresponding actions in the ApiController?
Please help us. Thank you all.
Most of cases, needless to have muptile post actions, I think. The typical case is consumer needs to edit user. So, s/he needs to load user data first to show on the edit form. After editing, consumer can click Save button to submit data and call POST action on api controller.
If your case is different, you should have nullable property for value type, and then the logic which should be checked in controller is if any property is null, it should not update this property into database.
You can only have one post action per controller action name. That is, you cannot do
// NOT VALID:
public ActionResult UpdateUser(string newPassword) { }
public ActionResult UpdateUser(List<string> newRoles) { }
However, parameters of the action can certainly be nullable. If a given property is not supplied in a given HTTP request, the value of the property in the controller would be null.
// VALID:
public ActionResult UpdateUser(string newPassword, List<string> newRoles)
{
if (newPassword != null) { } // It must have been supplied
if (newRoles != null) { } // It must have been supplied
}
Alternatively, you can have related controller actions that each handle one of your use cases, e.g. UpdatePassword(...), UpdateAddress(...), ...