# Custom lightbox login that mis-functions like registration. Why?
 

**URL:** <https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727>\
**Category:** Ask the community\
**Tags:** wix-members-area, question, code\
**Created:** [August 26, 2020, 7:33pm UTC](https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727 "2020-08-26T19:33:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wendymfoo](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/wendymfoo/32/23027_2.png) [@wendymfoo](https://forum.wixstudio.com/u/wendymfoo)\
**Post date:** [August 26, 2020, 7:33pm UTC](https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727/1 "2020-08-26T19:33:02Z")

</div>

I created a custom lightbox login for members, and I used the login() code from [https://www.wix.com/corvid/reference/wix-users/login](https://www.wix.com/corvid/reference/wix-users/login) . However, when I click the submit button, instead of the login function checking against my profile database for email and password, it creates a new profile.

I want the code to check against my profile database → logs in users → redirect to another page if successful. Help! And thank you!

import wixUsers from ‘wix-users’ ;  
import wixLocation from ‘wix-location’ ;  
import wixWindow from ‘wix-window’ ;

export function loginButton\_onclick(event) {

let email = $w( “#email” ).value;  
let password = $w( “#password” ).value;

wixUsers.login(email, password)  
.then( () =\> {  
console.log( “User is logged in” );  
wixWindow.lightbox.close();  
wixLocation.to( ‘/member’ );  
} )  
. catch ( (err) =\> {  
console.log(err);  
} );  
}

 ![](https://us1.discourse-cdn.com/wix/original/3X/2/b/2b35ef3b88008af84d62639d6b4954992a029599.png)

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [August 26, 2020, 7:54pm UTC](https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727/2 "2020-08-26T19:54:26Z")

</div>

Hello Wendy, take a look at this site here…

[https://russian-dima.wixsite.com/meinewebsite](https://russian-dima.wixsite.com/meinewebsite)

perhaps you will find some answers there for your issues. 😉

---

<div class="post-metadata">

**Author:** ![wendymfoo](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/wendymfoo/32/23027_2.png) [@wendymfoo](https://forum.wixstudio.com/u/wendymfoo)\
**Post date:** [August 26, 2020, 8:07pm UTC](https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727/3 "2020-08-26T20:07:06Z")

</div>

@russian-dima Thanks for the link, but I did not find the code to fix this issue.

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [August 26, 2020, 8:16pm UTC](https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727/4 "2020-08-26T20:16:07Z")

</div>

@wendymfoo  
You will find for every of your issues an example, already disscussed on my site.  
User the example and the corresponding forum-posts. Read all the stuff with all the issues and solutions, then you will be able to solve your issue.

---

<div class="post-metadata">

**Author:** ![wendymfoo](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/wendymfoo/32/23027_2.png) [@wendymfoo](https://forum.wixstudio.com/u/wendymfoo)\
**Post date:** [August 27, 2020, 1:12pm UTC](https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727/5 "2020-08-27T13:12:09Z")

</div>

@russian-dima I read through your site and still couldn’t find the solution that will solve my issues. Thanks anyway for your help.

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [August 27, 2020, 1:44pm UTC](https://forum.wixstudio.com/t/custom-lightbox-login-that-mis-functions-like-registration-why/39727/6 "2020-08-27T13:44:35Z")

</div>

You have incorrectly connected the Login button to a dataset (and a Submit action), while also connecting the Login button to a loginButton\_onclick() event handler.

You should also check the dataset to see if it is set to the correct item.
