• Welcome to KonaKart Community Forum. Please login or sign up.
 

Does "getCustomerByUsername()" exists?

Started by diegobuzzalino, January 16, 2010, 02:21:06 pm

Previous topic - Next topic

diegobuzzalino

I need something like this -> I need to gather some user information before the user logs in (user detected by cookies)

any ideas?

regards, Diego, from Argentina

(konakart rules!)

trevor

I don't understand fully what you need to do. The cart information is saved in a cookie so that an unregistered customer doesn't lose his cart contents. We have an API to save any other type of information in a similar fashion.

diegobuzzalino

First of all, thanks for the fast answer.

I'm working on "remember user and password" functionality.

So, I need to grab custom information from the database without logging in the user.
I guess that the "customerSearchIf" interface is the answer, but I can't find a factory/concrete class of this.

trevor

Does that mean that you want to automatically log in the user ?

diegobuzzalino

I don't want to work on "automatic login", because I'm not an Konakart-expert. I'd prefer not to change the login functionality.

I'd rather prefer to auto-complete the user and password fields on the Login Page, and then, continue with the standard flow, without any change.

(I know that this is not the most safe option, but for my business, it's safe enoufgh, and the cheaper option to implement.)

Currently, when the user log in, I store some information on the CustomX fields, and store a new cookie the user email.
That's working.

Now, I was working on "LoginAction", to add the logic for reading the cookies and the information from the databse. Here is where I found that I need a "getCustomerByEmail" or something like that.

I hope that I have been clear enough.

trevor

So you want to read the customer information from the database in order to perform an auto-complete ?

We only store the password in a hashed format so there is no way of retrieving it in order to do this.

diegobuzzalino

Here is where I thought about my trade off:
  - I need this functionality
  - I do NOT need extreme security.

So, I'm storing the password twice:
  - the original from Konakart
  - an encrypted version with different algorithm in a Custom field (This algorithm is reversible)

So, I do have the information on the database to fill the log in fields.
The only thing that I'm willing to do, is to grab that information from the database and put on a LoginForm in LoginAction (I added that form to the action in the sturts-config.xml file)

(BTW, thanks a lot for  the attention.. I really apreciate it)

trevor

In the application engine we don't allow anyone to see customer details other than the logged in customer seeing his own details. Otherwise through the api, customers would be able to see the details of other customers which wouldn't be very good!

What you could do is to use the admin api to get the customer details of any customer. In this case you'd have to log into the admin engine using an administrator username and password.

diegobuzzalino

mmm..got it...

in the admin code I have just found the method that I have been looking for on the client side:
     public AdminCustomer getCustomerForEmail(String s)

Let me think how I could use that from the client side..

diegobuzzalino

I know that Martin Fowler would kill me, but I think that in 20 minutes, I will be creating a database connection on the action, and directly grabbing that info.

trevor

Maybe better to implement a custom API call.