Problems with elements injected into HTML from user travel - azure-ad-b2c

when I set the ContentDefinitionReferenceId = "api.signuporsignin"
the login screen is shown with the elements sing up now
and forgot password
but among the html elements there is no select with the document type list that I have added. image here
enter image description here
Now when I change the ContentDefinitionReferenceId = "api.selfasserted" now if the list of document types is shown but there is no sign in button, sing Up now, forget the password.Image here
enter image description here

When using combined sign in and sign up, you cannot add more fields to the sign in page. The observation that it breaks the formatting is expected when attempting to do so.
https://learn.microsoft.com/en-gb/azure/active-directory-b2c/self-asserted-technical-profile#output-claims-sign-up-or-sign-in-page
When using selfAsserted, you can add more fields.
If you need more fields, this will be the only option. You will lose the sign up and forgot password links, you’ll have to add your own links if needed which go via your app to a separate B2C policy.

Related

how to access b2c sign in elements using javascript for UI customizing

i want to access b2c sign in page's h2, email and password elements to customize them.
using document.getElementsByClassName not giving any result
B2C injects it the html inside the predefined div with id api (<div id="api>). You can read more on this here. Now inorder to access the html elements injected by B2C inside the api div, you might have to check the structure of the html elements in the developer tools initially, and then try to select the specific element using javascript.
For eg: When B2C injects the html elements inside the api div, the section that contains the input tag for email looks like:
Now if you see, the input tag for email, doesn't contain any class there, rather if you check closely, you will find that each input element like for email or password is encapsulated under a parent div with class "entry-item". So in that case, the document.getElementByClassName would work on that level.
So to conclude, first identity the element you want to select using javascript using the dev tools on the browser, and then write the javascript accordingly.
In case the element you find doesn't contain any id or class, you can always use document.querySelector and select the tag to perform DOM manipulations.
Let me know if this works or if there are more queries around this.

Liferay: Remove 'Account Settings' fields

I'm currently trying to remove fields from the Account Settings page and I am not sure how to properly approach this.
There's not really a proper way I can do this with CSS as it's a bit of a hacky way and it won't do the job properly as I can't access that page through CSS properly.
Also on this topic, when accessing the Account Settings page, my custom theme changes to the admin theme. Is there a reason this happens when accessing this page, even while signed in as a user?
You can disable few fields based on properties/setting ,
Ex if you want to hide birthday fields then you can set this 
field.enable.com.liferay.portal.kernel.model.Contact.birthday=false same way  for gender also u can user
field.enable.com.liferay.portal.kernel.model.Contact.male=false,  but if  you want to hide  any  other field for which property/setting is not available you can actually do it either by theme or fragment module(hook).
To do from theme you may need to create a theme for control panel as, account setting resides in uses control panel theme  and then hide respected fields based on id
To do from fragment module you can refer below link
https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/jsp-overrides-using-osgi-fragments
Thanks

Orchard CMS - limiting pages to only a specific layer - how?

Silly really - but I just can't seem to find my way around this just yet....
I installed the Orchard CMS in Azure - worked like a charm, added a few pages, played around, watched the Pluralsight "Orchard Fundamentals" course - seemed to make a lot of sense.
But now I'm stuck - I'm trying to create a public facing site, where some of the pages should be visible to any visitor including anonymous users, and some of course should be visible to only authenticated users.
OK, so I understand those are layers in play - default for everyone, authenticated for authenticated users - great. But how do I limit a given page which is present as Content in my dashboard so that it'll be displayed only on a given layer (e.g. only on the authenticated layer - not the default layer for everyone)
Seems like a simple task - but I just cannot seem to find the way to do it (nor does any of the docs or tutorial videos really help :-( )
Any takers?
Layers are only for widgets. In order to restrict access to a content item such as a page, what you need is content item permissions. That's a separate feature that is not enabled by default.
To enabled the Content Item Permissions module
In the admin panel go to Modules
Start typing permissions into the filter box at the top left hand corner of the tabs.
The Content Item Permissions should be shown in the list, click Enable in the top right hand corner of its box
This will reload the page and you should see a message at the top saying Content Item Permissions was enabled
Enabling this feature with your pages
Orchard CMS uses a concept where you can glue components together however you want them to be composed in order for them to support the features you want. The concept of a page is just a collection of parts like a page title, a url, text, setting a publish date and things like that.
By default simply enabling the module doesn't make any difference. You will need to add the feature to the Page content. To do this you just need to:
In the admin panel go to Content Definition
Find / filter the Page content type and click Edit on the right hand side
Scroll down to Parts and click Add Parts
Search for Content Permissions in the list, tick the checkbox and press Save at the bottom of the page
You will be taken back to the Page content definition screen. At the bottom of the Parts list you will now see a Content Permissions entry. If you want to set up defaults for new pages click the little > arrow to the left of the header and a panel will expand.
If you want to add it to other content types such as blog posts then you can repeat this process and add it to any content type you want to.
Making an individual page password protected
Now that the feature is enabled and attached to your Page content type you can create a new private page by following these steps:
In the admin panel click New > Page in the sidebar
Give the page some basic content
Scroll down close to the end of the page and tick the checkbox labelled Enable Content Item access control
Let's say you want to make it so anon uses cannot see the page. Under the View this item section just tick all of the roles except for Anonymous (the second one in the list)
Publish the page
Open up a new incognito / in-private browser tab (so the site thinks you aren't logged in) and visit the new page you just published.
You will be redirected to an error screen similar to this page:
You will want to enable the Content Item Permissions feature in order to restrict individual content items to certain permissions. With layers you can only make widgets appear in different zones defined in your theme when the layer's rules are met.
To enable the Content Item Permissions feature, go to your admin dashboard and click on "Modules" on the left hand side. On the modules page enter "Content Item Permissions" in the filter text box to help find the feature. Click on the enable button of the feature in the top right corner. The feature will now be enabled.
Now that you have the feature enabled, you need to add the Content Permissions part to one of your content definitions. To do this click on "Content Definition" on the left hand side of the admin dashboard. Find the content type you want to add permissions to (for instance, Page) and click the edit button. Click the Add Parts button. You will see a list of parts you can add to the content type. Check the checkbox next to Content Permissions and click save.
Next, in the admin dashboard go to one of your content items that is of the content type that you just added the content permissions part to. You will see a new checkbox towards the bottom to enable content item access control. Click the checkbox and you will be able to set the different roles for that content item.
Edit: It looks like it took me too long to write my response. rtpHarry's editted answer is very similar but better formatted.

Browser add on/extension to intercept data selection then simulate link click and data entry

Background: a third party web application with a requirement on the order page to explicitly guide staff when a certain category of product is ordered.
Normal process:
select product to add order line (click on product image)
New process:
select product to add order line (click on product image)
[add on] simulate click on edit order line
[add on] simulate clear of default additional information form fields
enter additional information and click save
Note that the two steps to be performed by the add-on could be performed by the user however when things get busy or new staff begin is often the case that the order gets processed with the default value.
Any pointers in the right direction would be appreciated.
A multi-browser solution is preferred but not essential.
I am an experienced developer, including web development, but have no experience in browser add on/extension development.
Thanks.
You can make an addon out of this very easily. You addEventListener to the gBrowser and if the event.target is the product element then preventDefault so the click doesnt go thru (you will have to do mousedown and mouseup prevent as well). Then rather get the id of the "edit order line" and do .click() if that doesnt work and you really need to simulate use MouseEvent:
MDN :: MouseEvent
MDN :: Initatite/Dispatch MouseEvent
To enter aditional information get the id of the fields, and set their value. Then get the "Save" button id and then do .submit() or .click()
i said do get id in this post but you can use querySelector and go by css selector
see this page here on how to interact with content in currently selected tab:
https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Tabbed_browser
basically just do gBrowser.contentDocument.getElementById

How can I use base_path() inside a view in Drupal?

I have the following fields inside a view:
User ID
Teaser
I selected "exclude from display" for the User ID field.
In the Teaser field, I selected the "rewrite the output of this field" option. This way, I can use html to completely control the structure of the view's output. Moreover, I can call the User ID field by using it's token, [uid].
For example, I can do the following in the teaser's rewrite:
Visit Profile
The problem with the above code is that the path is relative. It will only work on the front page of the site.
For example, if this link is clicked in
www.example.com/node/1
then it will visit a non-existent URL of:
node/1/user/[uid]
I have tried the following: http://chopapp.com/#o7osql65
But views fields does not allow PHP codes.
I might be approaching this entirely wrong. Does anyone have any suggestions? Thanks.
You'll want to rewrite the output of the UID field, and have it be rendered as a link. Even if you exclude it from display initially, it will still be available as a link via its token to other fields. One of the options when selecting to 'output this field as a link' is to make the link absolute.

Resources