Jump to content

Prestashop BO login system HELP


Jimmy87

Recommended Posts

I'm newer with prestashop, and i really need to understund how the login system works ? i really need to know that just that i can add another requiered field for authentification like the phone number, i saw that there's a JS file who control the operation but i didnt' understund how it work with the sytem, to match the given user and password? i know that my questions are so basic, but i really need to know how the system login work and which files are running during the authentification opration ?

 

Thank you in advance for your Helps.

Link to comment
Share on other sites

you have to create new form field in admin template file, for exmaple with id= "yourVariable"

then in login.js file you have to include it to the data param (in ajax query)

function doAjaxLogin(redirect) {
	$('#error').hide();
	$('#login_form').fadeIn('slow', function() {
		$.ajax({
			type: "POST",
			headers: { "cache-control": "no-cache" },
			url: "ajax-tab.php" + '?rand=' + new Date().getTime(),
			async: true,
			dataType: "json",
			data: {
				ajax: "1",
				token: "",
				controller: "AdminLogin",
				submitLogin: "1",
				passwd: $('#passwd').val(),
				email: $('#email').val(),
                                yourVariable: $('#yourVariable').val(),
				redirect: redirect,

after that you can handle this variable with tools::getValue('yourVariable') in AdminLoginController

  • Like 1
Link to comment
Share on other sites

Thank you very much for the answer, but can i know how the system work to match the entered data like user and password with the information in database and which file are involved in this operation? your code is really helpfull and thank you again but im really interested to understund which files are used for the authentification system for BO.

 

Thank you again and i'm sorry if i'm asking too much.

Link to comment
Share on other sites

controllers/admin/AdminLoginController.php

 

this is controller file of login process (to back office).

there is a function:

public function processLogin()

and this is what you're looking for (especially this part: $this->context->employee->getByEmail($email, $passwd);) :-) i hope so!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...