User Login

  

The objective for this logic is to be able to the users to login using username or email address, which is being stored in users database.

sample db structure.

username           email address                          reason

testuser1             test@email.com    (they are a couple that would share the same email)

testuser2            test@email.com

1.lets say a user login with test@email.com

2. get the current list in users table with has username of test@email.com

the result would contain 2 records.

3.then i would try to login the first record testuser1

if login <> true then 

loop to the next record


problem: if i use the login functionality of users espace, during my initial login which is false

it would go to the exception page, what i wanted is, if the first login fails, it would loop as to how many records contains on the list using the test@email until it hit the correct password.

this feature or logic merely giving the users a flexibility to login both username and email.


Sample Implementation:


Thanks,

JunJun


Hi Jun,


To allow the user to login with username or e-mail, both need to be exclusive / unique per user.


Otherwise you can never be sure of what is the user / person that is being authenticated.


In an extreme example: if both use the same password and login with the e-mail, which user would you load?


Cheers,

Renato


Jun Jun wrote:

The objective for this logic is to be able to the users to login using username or email address, which is being stored in users database.

sample db structure.

username           email address                          reason

testuser1             test@email.com    (they are a couple that would share the same email)

testuser2            test@email.com

1.lets say a user login with test@email.com

2. get the current list in users table with has username of test@email.com

the result would contain 2 records.

3.then i would try to login the first record testuser1

if login <> true then 

loop to the next record


problem: if i use the login functionality of users espace, during my initial login which is false

it would go to the exception page, what i wanted is, if the first login fails, it would loop as to how many records contains on the list using the test@email until it hit the correct password.

this feature or logic merely giving the users a flexibility to login both username and email.


Sample Implementation:


Thanks,

JunJun




Renato Torres wrote:

Hi Jun,


To allow the user to login with username or e-mail, both need to be exclusive / unique per user.


Otherwise you can never be sure of what is the user / person that is being authenticated.


In an extreme example: if both use the same password and login with the e-mail, which user would you load?


Cheers,

Renato


Jun Jun wrote:

The objective for this logic is to be able to the users to login using username or email address, which is being stored in users database.

sample db structure.

username           email address                          reason

testuser1             test@email.com    (they are a couple that would share the same email)

testuser2            test@email.com

1.lets say a user login with test@email.com

2. get the current list in users table with has username of test@email.com

the result would contain 2 records.

3.then i would try to login the first record testuser1

if login <> true then 

loop to the next record


problem: if i use the login functionality of users espace, during my initial login which is false

it would go to the exception page, what i wanted is, if the first login fails, it would loop as to how many records contains on the list using the test@email until it hit the correct password.

this feature or logic merely giving the users a flexibility to login both username and email.


Sample Implementation:


Thanks,

JunJun




Hi Renato,

on the extreme case scenario, we will have a validation or the unique password or a username

is the primary reference during login. if the 2 users share the same email address is a valid argument

what i want to allow a user login using email address or username.

if 2 or more users shares the same email address (which is valid), 

during login the loop will get the current username and try to login

if login = failed, then loop again to the next user in the record set until the user can now login.


your thoughts on this.


Thanks,

Juius


Solution

Hello Juius,

You can do this:

Move the Login to a server action, and in case of exception, set the output parameter to False.
Use your Server Action in the place of the User_Login in your Screen Action.

Now, instead of an exception in your Screen Action, you will receive a True/False value from your personal login function that tells if the login was successfull or not.

Cheers.

Solution

Eduardo Jauch wrote:

Hello Juius,

You can do this:

Move the Login to a server action, and in case of exception, set the output parameter to False.
Use your Server Action in the place of the User_Login in your Screen Action.

Now, instead of an exception in your Screen Action, you will receive a True/False value from your personal login function that tells if the login was successfull or not.

Cheers.

Thanks Eduardo,

amazing approach.

Thanks,

Julius