Magnolia CMS - Public user registration Notification - magnolia

I am using Admin-supervised registration (Never) strategy as Public user registration. With this approach, Admin needs to enable the user, but admin is not getting an email. Is this the expected behaviour or admin should get an email to notify new user has been registered. If that is not out of the box feature, How can I enable admin to get an email when the user is registered ?
Also, I would like to know can I mix and match Registration after mail notification and Admin to enable. Then we can make sure provided email is correct as well and Admin to control to access.
Thanks.

For getting the notification, you can simply add custom strategy that would wrap the ootb provided one and send email on top ... or you can add observer on the users workspace and configure it to call MailCommand upon new disabled user being created in the repo. Whichever of the two suits you better.
As for combining two of the existing strategies, the simplest way to achieve that is by writing your own that will indeed do combination of the two provided out of the box. Since each of the functionalities you desire is there, it should be rather simple to combine them in one class.
HTH,
Jan

Related

setting up customize action URL in firebase email template dynamically

I have two web application sharing one firebase (auth, db etc), it all works well, but i when users want to do a reset password, the email i can see in the Password reset template allows me to change it but i don't want to be hard specific on the url, given the password request might come from either application, is there a way to let firebase know which link to use or possibly set it from the code ?
It is not possible to change it to a fully customized URL(like mywebapp1.com), the reason for that is that it won't be possible to check if the modified URL is a valid one.
You have 2 options:
You can get a custom domain like authApp.com and follow these steps on the documentation so you can have a more personalized experience for both apps.
You can create dedicated emails based on the app (the URL will stay the same) using action links , this will show a nice layer of customization to your emails based on the specific web app being used.

Handle Failure Of Updating displayName in firebase

as far as I know, there is no option to set displayName with email and password when signing up a user using firebase auth.
for example, if I have a signup form like this
I can handle the profile update just after the createUserWithEmailAndPassword has succeeded.
or I can create an onboarding section where I could just ask the user separately for their name, and remove the name from this form. which is what I'm currently doing.
but when asking for the name in the form itself what if the signup has succeeded but the display name update has failed. what am I supposed to do in that situation
You'll have to define the course of action on your own, depending on the requirements of your app. There is not a single correct way to handle this.
You could send the user to another form that asks them for their profile information again, or you could simply ignore the error and let them update profile information later. It's entirely up to you.

Login with different accounts

I am trying to create my application with Google app maker and Ineed to create login with different accounts? how can I create a login with different users roles and each user has a specific pages to see
There's a simple way to do this. Please click on the links in my answer below to go to the screenshot I've added for reference.
Go to App Settings -> Security and add roles you would like to create for your app in the space provided.
In a page, you can go to the Property Editor, scroll down to Security and mention who can see this page.
In a model, you can add controls by going to the Security tab and selecting relevant roles for specifying who can create, load, save or delete records for that model.
Finally, to mention which email address goes into which role, you can go to a specific deployment and add the email addresses for each role manually.
Let me know if this helps. Feel free to ask any questions you may have!

Connecting to multiple social logins within HWIOauthBundle

I'm trying to arrange being able to login with a social network (initially LinkedIn, but it could be any other, or self-generated from FosUserBundle), and then adding new connections to the same user, via Twitter, FB, Github, etc.
The difficulty is connecting the multiple account connections within FosUser and the HWIOauthBundles. In order to collect as much data as I can, and be able to easily add additional connections to services, I'd really like to have each new connection as a one-to-many record. IE: The initial login with LinkedIn creates a FosUser record, and a new row in a 'socialLogin' table, the next (say login with Twitter) adds a new row to the 'socialLogin' table, that refers back to the fosUser.id.
How can I use the currently logged in (Fos)user as part of the new record that HWIOauth would generate? The end result would be, being able to login with any known user to get into the same account.
The solution is actually easy. First check out Symfony2: How to login using OAuth (HWIOAuthBundle) + custom roles (by default and loaded from DB) which is a great how-to for HwiOAuthBundle, and then scroll down and carefully look at public function loadUserByOAuthUserResponse(){ ... } section.
From there, your workflow will be checking the provider name from the response object. And then based on the provider name, you can update your user (use email for searching). However, with twitter you may have problem because twitter doesn't supply user email. So you need to ask your user for that email address and after you get that, you may need to merge current user account (for twitter based reg, consider it as a temporary a/c) with previous user account with this email.
Otherwise, if your user is already logged in using form/other-social-login (before connecting with twitter) you can add his twitter details once he connects with it. But you need to store user's currently logged in details in session (so that you can fetch it after user comes back with twitter token)
Hope it helps
First step would be to create the relation between the user entity and the social_data table and the rest is all about overriding the custom user provider FOSUBUserProvider.php, which I believe you already have started doing as you have FOSUserBundle and HWIOAuthBundle working together.
I will make some edits with actual code later, but I had to answer this to get you on the track until then.

Properties which handles by Drupal 7 default User Login Process

I'm a new to Drupal but I just want to hack/customize the login function of Drupal 7, like hardcoding. As i have discovered that Drupal 7 login process is handling by user.module and its associated files.
I just wanna know which kinds of values or properties are returning or providing when a user logging/authentication process is done by providing just Username/Password.
The final properties it returns, to provide back to Drupal (along the whole authentication process) that I just noticed so far are:
{uid} of the attempted user
{rid} role id of the user
user email
user is blocked or not
then .. ?
The point is .. what other else?
Can i replace/modify the whole existing authentication process? (as i need)
For example, one of the default auth functions in user.module:
function user_authenticate($name, $password) {
..
return $uid;
}
For example, if i modify (hardcode) that function to connect to my other external database(s) and return {user id}, the Drupal will get one auth requirement {uid}. Then what other else to provide? User Role and .. etc etc ?
Like that .. what other functions and properties else should i touch and provide back to Drupal along the authentication process?
This is not an actual answer but I cannot post this as a comment.
Basically we do not hack core. So looking at the user.module's code will not help you very much than learning the hooks. For an example, It's difficult to get an idea about how to add some magic when a node is created by looking at the code of hook_nodeapi(). But if you check the docs and the return/input arguments, it's much easier to do the job.
I'd start by adding an extra submit handler to login form using hook_form_alter(). I have seen some other threads from you about your use case but unfortunately it's difficult to provide a sample code for you.. You can see how other modules implement extra authentication (e.g: http://bit.ly/LdRcm6). (See how Remember Me module adds a checkbox to login form and twitter module that allows twitter login).
Then, you can have Drupal to authenticate the user as normal, and your new custom functionality in addition the Drupal's authentication.
Drupal can even connect to external databases no matter if it's Drupal or not.
As you can see in many functions, they returns a Boolean value or sometimes, the user ID. user_load() is the function that loads a basic user object.
Remember it's modular. Some modules can include/remove/alter these values using hook_user_load(). user terms module and profile module is a perfect example here. It includes profile field information when other modules require user information.
A single user is not just a set of information. It can be modified during any part of the process. So do that. Use your module to provide information that your external site has.
{uid} of the attempted user
{rid} role id of the user
user email
user is blocked or not
user last login time.
user register date.
...
To see the entire object for your site, enter the following.
<pre>
<?php
$user_account = user_load (1);
print_r($user_account);
?>
</pre>
You can enter this code in a node create page where you have php filter used.
Without hardcoding, you can allow other modules to make use of these values. Even if your source database has no role ID, you can ive them a role ID, a user ID, and such.
Good luck!
Drupal is an extensible system. There is no need to do "hardcoding" in core modules like the "user" module. You should rather explore the hook system that allows extending the core (and also contributed) modules.
And in case you want to fetch user id's from a different database (I am not clear about this usecase), you can still use the roles, and other user data, from Drupal's database.

Resources