Even after days of reading and going through several tutorials I still cannot figure out how to use AAD B2C custom policies to arrange the login / signup UI. As my starting point I am using the starter pack for SocialAndLocalAccounts.
I would like to:
Move the social logins above the email/password section. I could maybe achieve this with custom page css, but surely I must have some control over the page content with the custom policies or is all this hardcoded the way it is presented?
I want to add a terms link only on the signup page. This I cannot do in the custom page css because then it also appears on the login page of the combined login/signup flow. I have enabled js so that I can replace a text element with my hyperlink to the terms as hinted at in the MS Docs. However, this example assumes you will have a checkbox, but I don't want that. Only a simple div with the hyperlinked terms for the user to read. I can't figure out how to insert a simple text field in the form which will only appear on the signup page - because I cannot see how the elements on the pages are created. Are they hardcoded based on claims?
PS! I read that you should not edit the TrustFrameworkBase.xml, but in order to remove claim types from the form such as given name, surname and displayname I can find no other way. I can add new things in the TrustFrameworkExtensions.xml, but I can't remove things from the base as it seems to merge the two.
For #1 I ended up using css as Jas Suri suggested. In my unified.css I added
.claims-provider-list-buttons, .social {
display: block !important;
}
This takes the social logins out of the footer of the table and thus it ends up on top. Note that in version 1.2.0 (urn:com:microsoft:aad:b2c:elements:contract:providerselection:1.2.0) it is .social, but in 2.1.4 it is .claims-provider-list-buttons - so I target both.
For a bit more spacing before email login I also added:
#localAccountForm {
margin-top: 40px;
}
For #2, in TrustFrameworkBase.xml I added a new ClaimType:
<ClaimType Id="extension_terms">
<DisplayName>Accept terms, but this will never be shown as hidden by css</DisplayName>
<DataType>boolean</DataType>
<UserInputType>CheckboxMultiSelect</UserInputType>
<Restriction>
<Enumeration Text="" Value="true" SelectByDefault="true" />
</Restriction>
</ClaimType>
Added <OutputClaim ClaimTypeReferenceId="extension_terms" /> to the TechnicalProfile
LocalAccountSignUpWithLogonEmail.
In the unified.css of the custom pages I make sure the checkbox and text is never shown:
#extension_terms_true {
display: none;
}
label[for="extension_terms_true"] {
display: none;
}
Then I create a new js file custom-ui.js included in the custom-ui.html as normal: <script src="https://filmwebidlogintest.blob.core.windows.net/filmwebidloginblob/js/custom-ui.js"></script> This js file contains:
function addTermsOfUseLink() {
// find the terms of use label element
var termsOfUseLabel = document.querySelector('#api label[for="extension_terms"]');
if (!termsOfUseLabel) {
return;
}
termsOfUseLabel.innerHTML = 'To use this service you must accept the service terms and privacy terms.';
}
$(document).ready(function () {
addTermsOfUseLink();
});
I feel this is very hacky, but it works and I can find no better solution.
For information on the custom HTML/CSS I've used read this MS Documentation.
Related
I need to create a footer in a Liferay-project, that can be modified from the instance. I've been trying various things in my footer-code and instance, but haven't figured out how to do it.
Any content inside the footer can't be touched and in page edit mode, Liferay says "This area is defined by the theme. You can change the theme settings by clicking more in the Page Design Options panel on the sidebar". I didn't get any help from Page Design Options either. Is there a way to do this?
I found the answer after hours of work and searching and want to share it with everyone here. The working solution was found here, in one of the comments.
You need to write some code (I use Freemarker/ftl) and then configure the site pages a bit, but here's how it works:
Put a new setting inside liferay-look-and-feel.xml:
<settings>
<setting key="footer-article-id" value="" configurable="true" type="text"/>
</settings>
This will create a new configurable option in page options, allowing you to input the ID of the web content.
NOTE: <theme> might get underlined red "The content of element type "theme" must match". This still prints everything correctly, but the tags are given in a wrong order. Inside my <theme>, I have <template-extension>, <settings> and <portlet-decorator> in that order, which removes the error.
Assign a variable in init_custom.ftl (cleans up the footer-code):
<#assign footer_article_id = getterUtil.getString(themeDisplay.getThemeSetting("footer-article-id"))/>
And then add this to the footer-code, to create the spot, where the content is visible:
<#liferay_journal["journal-article"]
articleId=footer_article_id
groupId=page_group.groupId
/>
After this, everything should be ready code-wise.
Create a Web Content for your footer. In the creation screen, there's an ID on the panel on the right. Publish your content and grab the ID.
Finally, go to Site Builder --> Pages and click on configuration from the top bar (behind three dots). You should see the input field like in the first picture: That's where you add the ID.
Save the settings and your web content should now be in the footer.
Hope this helps!
I am working on Liferay 6.1 and I want to remove portlet header section completely for one of the portlet( This should not be visible for admin even)
Header section is edit,minimize,maximize,delete and title bar.
I have tried removing border but in vain. Also tried additional style sheet options
PortletId is correct as I am able to change other styles
p_p_id_top_WAR_SecondPortletProjectportlet_.portlet-borderless-bar {
display:none;
}
p_p_id_top_WAR_SecondPortletProjectportlet_.portlet-topper {
display: none;
}
p_p_id_top_WAR_SecondPortletProjectportlet_.portlet-title {
display: none;
}
Try this code
p_p_id_top_WAR_SecondPortletProjectportlet_ .portlet-borderless-bar {
display:none;
}
p_p_id_top_WAR_SecondPortletProjectportlet_ .portlet-topper {
display: none;
}
p_p_id_top_WAR_SecondPortletProjectportlet_ .portlet-title {
display: none;
}
As you are using css class you need to give space before using it.
More Info css .class selector
Edit: Sorry, I misread your question - You're explicitly asking about an embedded portlet. Disregard my answer, I'm not deleting it as this question might be found by others that are looking for this solution for non-embedded portlets.
I'm suggesting a slightly different approach than you ask for:
Don't display portlet borders. This will do the job if you also uncheck the "Display Edit Controls" checkbox in the dockbar. However, it will allow you to move the portlets on the page, configure them as you need.
Alternatively, specify in your theme that you don't want to show the borders by default - this way you don't have to change each single portlet's borders, but they're all gone at the same time (provided the current border-display-setting is on default):
in liferay-look-and-feel.xml add this line:
<setting configurable="true"
key="portlet-setup-show-borders-default"
type="checkbox"
value="false" />
When you disable borders, some handle will only appear if a) "Display Edit Controls" is checked AND the user is hovering the mouse over a portlet.
After that, don't grant the full Administrator role to people that you don't want to see the controls at all. Instead create an alternative role with permissions that match your requirements - this typically involves setting portlet preferences for the single portlets, configuring permissions for them as well as changing/modifying pages (try them out, I can't name them from the top of my head)
I have a custom module that replaces the default RolesBasedAuthorizationService with almost identical code, except that, when my custom module is enabled, it will pull roles from a service instead of from the user. Enabling the service involves filling out information in Settings and checking a box.
Since the roles are replaced when using my custom module (and the functionality is enabled), I want to hide the roles on the Edit User page. Following Understanding placement info, I can successfully hide the Roles list using the following in my custom module's placement.info:
<Match ContentType="User">
<Place Parts_Roles_UserRoles_Edit="-" />
</Match>
However, that will hide the list whenever my module's feature is enabled. But the feature being enabled isn't all that has to happen for the feature to do its magic - the checkbox also has to be checked (which provides the ability to enter the required settings before turning on the service-based authorization). So, continuing with that same piece of documentation, I can create a wrapper and apply it like so:
<Match ContentType="User">
<Place Parts_Roles_UserRoles_Edit="Content:10;Wrapper=Wrapper_HideIfCondition" />
</Match>
This should allow me to wrap the roles list like so:
<div style="display: block">
#Model.Html
</div>
I'm currently using display: block to make sure the wrapper is being called; however, the roles list disappears - it appears that Orchard isn't finding the wrapper. The cshtml file exists at MyCurrentTheme\Views\Wrapper.HideIfCondition.cshtml - I was hoping to get it into the Module, but I'll wait on that until I get it working in the default way (in the theme).
So my current question is thus: What am I missing in order to get the wrapper to be found and used?
Well, the reason it won't work how you are doing it currently is that your theme isn't being applied in the admin. The Admin Theme is. So you could chuck your code in the Admin Theme, then it would work. Preferably create your own admin theme if that is the route you are going to go down.
If you want to put it in a module, you need to make sure your module depends upon Orchard.Roles else Orchard.Roles placement will take priority. So in your module.txt you will need this line:
Dependencies: Orchard.Roles
Placement file:
<Match ContentType="User">
<Place Parts_Roles_UserRoles_Edit="Content:10;Wrapper=Wrappers_HideIfCondition" />
</Match>
Then you wrapper will be in your views folder and called Wrappers.HideIfCondition.cshtml with something like:
#using Orchard.ContentManagement;
#{
var condition = true;
}
#if(condition)
{
#Display(Model.Metadata.ChildContent)
}
<p>I am a wrapper</p>
Hope this helps
In Liferay I have used the asset publisher to publish news on my news page. I want to fetch the 3 top news from the page and embed it into another page. How can I do this? The page URL containing the news links looks like the following:
Liferay.Widget({ url: 'http://test.com/testnews/101_INSTANCE_f22'});
Liferay itself has a property where one can share an asset publsiher instance any where else on a site, but that is not exactly what I want. So any help or guidance is appreciated. Thanks.
If you want only links then you can set display style 'title-list' (this will take you to the article on the main news page).
if you want to open the link in another page, change asset link behavior to 'View in a specific portlet'.
You can change the look of asset publisher to whatever design you want. follow the path look & feel --> advanced styling --> Copy the portlet id. Now by using mozilla firefox pick the class,tags,etc. and write your css code. This will override the basic design. E.g.
#p_p_id_101_INSTANCE_8f5JPIxv8ml0_ .asset-abstract {
width: 25%;
float: left;
}
Is there a particular reason why you don't want to configure another AssetPublisher on the second page? You can just use the identical configuration, but limit the number of results shown to 3 - done.
Problem solved. Here is the solution with jQuery:
$.get('http://test.com/news/', function(data) {
var top3links = $(data).find('a:lt(3)');
$('#top3').html(top3links); // });
Gmail introduced a trimming feature in emails for "better readability". This causes a lot of pain for me, as I have a notification system for email, where I send some html email messages to users. Basically email looks like this:
divs and styling
Object alert in Project by User
tables and tr/td
User Action on Object in Project
/tables and tr/td
/divs and styling
link
footer
To group all emails in one conversation, first email has subject, subsequent emails have Re: subject.
Active users can receive significant amounts of emails like this, but due to "better readability" feature, ALL of the email content (starting from second email) is suppressed.
I am looking for advice - maybe I should redesign my html, or gmail has some anti-suppression code, or just a hack to go around this issue.
Issue from users perspective is described here: http://www.google.com/support/forum/p/gmail/thread?tid=756b83fa60ca1df7&hl=en
I had the trimming problem occurring on a table of an HTML newsletter.
It was very important that the entire table display because it was the
#1 content our client wanted to communicate. Here's the fix, or at least here's how we solved our problem. We eliminated any repetition.
So for this table, the lines in between each row, Gmail was seeing the
lines as repetitive. So I altered the pixel width by 1 px every other
line, which eliminated the repetition and fixed our problem. So that
said, look for repetition, and try to remove it. OR in some cases, you
might have to add type (in white) to create the variation.
Source.
PS: This is a bit unrelated, but I stumbled upon this question while looking for a way to disable the content trimming and keep the conversation view at the same time. I didn't find anything, so I developed a small extension for Chrome and Firefox.
It turns out that there is a very simple rule which causes this behaviour: Gmail will clip the email as soon as it sees the sender (From:) name in the body of the message, regardless of where this appears.
Solution: make sure that that the From: name in your email is not used in the message body (except in the signature, which will probably get clipped!).
This is an awful bug in Gmail, if you're unlucky enough to get bitten by it.
In my case, it was "trimming" an entire message, in a clean thread. See an example here, noting that the "trimmed" content is expanded in the screen-shot.
I ultimately worked around Gmail's bug by removing the entire header you see in that example ("Awesome Home Swap"), including the border below it. I stopped short of actually trying to figure out what specifically was making Gmail confuse that header as a "signature" (though I suspect it could have been the border, implemented using CSS directive border-bottom:1px dotted grey to style the <td> element).
I just found a solution that worked wonderfully for me. Simply create a bunch of hidden unique images throughout your emails to provide uniqueness to parts of the email that aren't actually unique. I'm building my emails with React so I have this Unique components that I'm using pretty much everywhere:
import * as React from "react"
function random() {
return Math.round(Math.random() * 10000000).toString()
}
class Unique extends React.PureComponent {
render() {
return (
<img style={Unique.style} src={`data:image/png;base64,${random()}`} />
)
}
static style = {
visibility: "hidden",
display: "none",
width: 0,
height: 0,
color: "transparent",
background: "transparent",
}
}
One thing I like about this solution is that it doesn't mess up the email preview text that would otherwise happen if you're using hidden text.
Add a double hyphen -- before the collapsed part. I was able to wrap it in a with font color matching the background. Worked for me...
I looked at the emails Gmail sent. Adds the following code (spacer.gif).
I guess this is the solution.
<img alt="" height="1" width="3" src="https://notifications.google.com/g/img/AD-FnEztup4OClDshQhMVXDbi6Oi0lSN-FgEY1jyW384aotccA.gif">
</td>
</tr>
</table>
</body>
</html>