Joomla2.5.14 Server Side Validation for Login Page - joomla

I am using Joomla2.5.14 and I want to add some more server side validation like:
a) Please enter your email address. (Outline email address box in red).
b) Your email address is not registered with Us. (Outline email address box in red).
c) Your email address is invalid. (For invalid email address which is different from registered email address - Outline email address box in red).
d) Please enter your password. (Outline password box in red).
e) Your password is incorrect. (Outline password box in red).
in Joomla login page.
For my project I have added "awoelogin" to login with email address.
Can somebody guide me where to apply changes in Joomla files. I want to show error like this style (http://docs.joomla.org/Display_error_messages_and_notices).
Currently I am getting only one error. (Check my attachment)
Thanks

Insted of changing Joomla files, can't you try using a component like Chrono Forms?

You can make this in components/com_users/controllers/user.php in method
public function login()
{
if( /*Some Statement*/ )
{
$this->setRedirect($link, 'Some Error Text', 'error');
return;
}
/* Here Goes Joomla Code Wich Makes Login */
}

Related

How to update a field in a database via email?

When a user subscribes to news from the site, he receives a welcome letter in his mail with a question, does he really want to subscribe to news?
Also in the letter there is a button that confirms his consent to the newsletter.
How can I make it so that when I click this button from an email, the values ​​​​in my database are updated?
This is my mail form welcome.blade.php
Welcome, User
<form action="{{route('welcome', $data->hash)}} method="POST">#csrf
<button type="submit">Click me</button>
</form>
Controller
public function welcome($hash) {
\DB::table('config')->where('hash', $hash)->update(['agree' => 1]);
Route
Route::post('welcome', 'WelcomeController#welcome')->name('welcome')
Embedding forms in emails is not allowed/recommended. It is a security risk. Email clients will simply warn the recipients of potential danger and will disable the form.
You need to add a link to your application in the email content.
click me
When a user will click on the URL below route will hit.
Route::get('/add-consent/{token}', 'WelcomeController#welcome')->name('welcome');
In the action identify user based on token and perform the action.
public function welcome($token) {
// Identify user based on token and perform the action...
\DB::table('config')->where('hash', $token)->update(['agree' => 1]);
}

How to change validation of wcmp vendor registration form password field(wordpress)

I need to edit password validation of wcmp vendor registration form.
I know the reply is too late and you might have already found a solution.
However, for others out there, in order to remove the password validation for WCMp vendor registration form, add this to your functions.php in your custom/child theme.
add_action('wp_footer', 'remove_wc_password_strength_meterscript');
function remove_wc_password_strength_meterscript() {
wp_dequeue_script('wc-password-strength-meter');
}

the hint and saved password overlap on the login page

I am doing web development in Yii framework and PHP. I am writing a login page. On this page, there are two forms. I used the attributeLabels() function to set the labels for these two forms. One is User Name. One is Password. We can call this kind of labels as hints or placeholder text.
After I logged in my system on safari and clicked the button of "saving password", then the system stored my user name and password. The hint and the saved password overlapped when I came to the login page again.
I have no idea how to fix this bug. I searched the Internet but did not find any useful suggestions.
Thank you in advance.
public function attributeLabels()
{
return array(
'userName' => 'Player/User Name',
'password' => 'Password',
);
}
I am not familiar with this particular framework, but it sounds like you mean the placeholder text that displays in the password field, and the saved password dots or stars that appear when your browser inputs the password for you are overlapping.
This will happen when you are using javascript to place and remove the placeholder text, usually done for browser compatibility with the standard placeholder attribute. it is probably being triggered on focus or key press in that field, but since the browser doesn't trigger those events when its placing your password in the field it does not remove the placeholder text.
Changing this to a trigger that repeatedly checks that there is something in the value attribute, or something like that will make sure that it will remove that text when there is a value to the field.

How to get email address from a People Picker control after EnsureUser is called in SharePoint?

I have one People Picker and Label on a page, and once I ensure that the user is available in Active Directory, I need to bind the user's email address to the label control. Where would the code for this need to be written? Should it be in the PageLoad() event handler?
yes, you can access the SPUser object (which holds the email property) like this:
var accountName = peoplePicker.Accounts[0];
//this will create a new account on SharePoint if a user with the given accountName does not exist
var user = web.EnsureUser(accountName);
lblEmail = user.Email;
peoplePicker obviously is the people picker control, web is an instance of the current web you are in (you can use the web of the SPContext.Current.Web aswell).
There is not specific event that fires when you enter a username in the people picker and hit enter, however you can set the AutoPostback property to true that then fires a generic postback which you can handle via Page_Load...
Define the PeoplePicker in your markup as followed:
<SharePoint:PeopleEditor AutoPostBack="true" ID="peUser" runat="server" />
In the Page_Load you simply check whether the people picker holds one (or more, depends) accounts with the Accounts property and then perform your task...
hope this helps
If all you want is the e-mail address, this should work:
if (pectrl.ResolvedEntities.Count > 0)
{
PickerEntity pe = (PickerEntity)pectrl.ResolvedEntities[0];
string email = pe.EntityData[PeopleEditorEntityDataKeys.Email].ToString();
}

Display a success message to user in a SharePoint Document Library after validation in ItemAdding Event

When validating a document in the ItemAdding event there are many ways to display errors to the user, but there doesn't seem to be a way to display successes to user, like a validation was successful. An info message to the user at the top of document library would be great.
public class MyItemEventReceiver : SPItemEventReceiver {
public MyItemEventReceiver() {}
public override void ItemAdding(SPItemEventProperties properties) {
// Do some validation
// If successful display message to user - can't seem to do
// If unsuccessful cancel and go to the error page - easy
}
}
}
In the event handler you have a Property called Cancel when set to true it will redirect you to the Error Page. Whereas when you dont distrub it, it will redirect you to the Metadata page of the document, i.e it will as you for the Name and Title of the document. Being said that out of the Box it is not possible to archive what you want to do. One alternate approach I would suggest is that once the validation is successful, set a Flag in the Session / Property Bag of the List with the Document GUID as the Key and in the Final Landing page deploy a Custom Web Part that will check for the this GUID and if there is a Value then It will display the Message.
Umm... edit List's AllItems.aspx or edit your masterpage, add Literal control to it. At ItemAdded event just refer to that control and set it's value.
Maybe it turns out you even need code-behind for that masterpage. Refer here.

Resources