Catching and customizing Apexpages Messages in Apex

As we know, apex:pageMessages tag can be used to display all messages that were generated for all components on the current page, presented using the Salesforce styling, as the following source code we use:

Controller Class(CommunitiesSelfRegController)

Visualforce Page(CommunitiesSelfReg)

But how do we customizing the styling of messages, if those were generated from Salesforce Standard components, such as making user login with Site class?
Actually we can get that from Apexpages class, as the following source code :

Controller Class(LoginController)

Visualforce Page

Enjoy it!

Related Post

Batch Apex running mode (parallel and series) and ... In my early post, I’d shared about how to write a Schedulable Batch Apex in Salesforce, and I’ll show you how transactions run in batch Apex and how to maintain their state across these transactions in this post. Batch Apex running mode (parallel / series) As we know, each execution of a batch...
Instantiating an Apex class based on dynamic strin... Somtimes we need to instantiate a Apex class by dynamic value in Salesforce, which can make our program more modular and more readable, such as the below case : 1. Each Contact has its socail fields : "Type__c" and "AccessToken__c" 2. Needs to request its profile via socail api in Apex Firs...
Using Aggregate SOQL queries/results in Batch Apex In previous post, we had created a schedulable batch apex that implements Database.Batchable in Salesforce, but if you want to use SOQL having aggregate functions like SUM(), MAX(), COUNT() on results grouped by “GROUP BY” clause in start execution, changing to interface Database.Ba...
Salesforce Apex Zip Attachments With JSZip Sometimes we need to zip Attachments or PDFs and download it at once in Salesforce development. As we know, Apex does not support Zip. it is conceivable that Zip files with other service such as Heroku or AWS, But in fact we can do this without any External Service, just Salesforce and JavaScript....