Custom Login Page Issue

@tombe
I have an issue on my www.wssmda.com project.
I created a new member application form in a regular page (as suggested by a wix support agent to the contrary of what the wix custom forum code page suggests) and was able to make it work.
The new member application should just be submitted to the database and wait for approval by the admin. The new member candidate should also be able to go to the login/sign up page and request new member access through the “sign up” process.
The problem I am dealing with is once the form is submitted the “My Profile” and “Login” buttons change state and show the new user name and “Logout” before they are approved.

  1. How can I just receive the application and require the new member to “Sign Up” for website access separately? In other words, disable the system from logging in the new member automatically upon form submission??
  2. Why can’t I see the "sign up” option on the login page in general anyways?
    Thanks.

@info52 ,

I’m trying to understand your issue.

I see you use wix-users to provide a sign-in interface for your users. As far as I understand, you used it before to also provide a sign-up interface.

Then you created a custom form to replace the standard one.

Is that right?

Hi Yevhen.
I created these custom pages/features.

  1. Member profile page (view & edit)
  2. Member sign in and My Profile Buttons
  3. New member sign up form

Issue #1
My Profile button shows the last logged in person when you’re not logged in

Issues #2
When new profile info submitted through the new member sign up form it shows the new member’s name on the My Profile button. This should be just a submission and should not trigger a “logged-in user” behavior.

Issues #3
New member is taken to the Membership Payment page upon submitting the profile form. When I click on the Pay Membership button it takes me to the Log in page and asks me to log in.
Correct logic is: The new user submits the form to members database collection => makes the membership payment and waits for admin approval.

Did you try the website? Hope you can help.
Thanks.

Hi Tom.
Can you please advice?
Regarding the wsssmda.com website
Issue #1
My Profile button shows the last logged in person when user is not logged in

Issue #2
When new profile info submitted through the new member sign up form it shows the new member’s name on the My Profile button. This should be just a submission to (Member-Profile) database collection to request membership. It should not trigger a “logged-in user” behavior which results “My Profile” button to show the user’s name even when they are not logged in or approved.

Issue #3
New member is taken to the Membership Payment page upon submitting the profile form. When I click on the Pay Membership button it takes me to the Log in page and asks me to log in.
Correct behavior should be: The new user submits the form to members database collection => makes the membership payment and waits for admin approval.
Hope you can help.
Thanks.

Tom
I re-did the entire database and resolve the above issues.
1 - I am having trouble with the date input box. I can not connect it to the database. And in the past when did connect I couldn’t get rid of the time value. I wanted it to show mm/dd/yyyy only.

2 - Also, I figured the solution to issue #2 above can only be solved if the new member submits to a separate collection. So I created a “New Member” collection for the info to be submitted. But now I am looking for a way to transfer the information from one collection to the other for when the member is approved and needs to be in the Members Collection. Any advice or tutorials for this?
Thank you.

Hi @info52 ,

Yes, tried the website.

You use wixUsers.currentUser.loggedIn to check if the user is signed in. You also use the standard sign-in form opened by wixUsers.promptLogin({ mode: 'login' }).

wix-users module is a part of Wix platform. When a new user registers via the sign-up form opened by wixUsers.promptLogin({ mode: 'signup' }) (there’s also wixUsers.register function allowing you to create a custom sign-up form), the user is added to your site’s Member List and Contacts and you receive a notification about a new member. Once you approve the membership, the user can sign in via the sign-in form opened by wixUsers.promptLogin({ mode: 'login' }) (there’s also wixUsers.login function allowing you to create a custom sign-in form).

The registration process (either via the sign-up form opened by wixUsers.promptLogin({mode: 'signup'}), or by calling wixUsers.register ) is the key. Currently wix-users know nothing about users added to your collection via your custom sign-up form. And looks like the Paid Plans app also expects the user to be a site member.

So I think you need to update your custom sign-up form to call wixUsers.register upon submission (you’ll need to ask the user for password).

Thanks for your response.
I kind of tried but couldn’t figure out how to make it work.

All I care is that a new user can submit a form and make a payment and become a member without approval.
Something always causes problem. The payment page didn’t work all day and then now the new member application form doesn’t submit.

Hey @info52 ,

Since you have automatic approval for everyone who sings up , calling wixUsers.register when your custom sign-up form is submitted will not only register the user but also sign them in automaticaly. That means you can redirect the user to “Plans & Pricing” and they’ll be able to proceed with payment without having to sign in (since they’ve already signed in as the result of the registration).

This is only possible if new site members are automatically approved (they’re for your website).

If you want to keep this flow (when a new member is redirected to “Plans & Pricing” and is able to proceed with payment) but at the same time have an approval process for new members, you can create a boolean field for the approval status in your member collection and, when the user comes to a page other than “Plans & Pricing”, check the status and log the user out if they’re not approved. This is just my brain dump.

The problems you’re trying to solve aren’t that easy. There are different ways to solve them (for instance, I think that instead of having custom member collections you could store custom information about your users as custom fields of the member contact). You might consider hiring a Wix Expert to help you build your website.

@yevhen-pavliuk
Hi Yevhen.
Thanks for your reply again.
I was able to fix the new member sign up issue once wix resolved the “Sign Up” button not working issue. New members now can sign up and pay. I used a text information for the last step on the payment page with a button to direct people to fill out their profile. This was so I could work around the Payment page not being customizable with where the user lands when done with the payment process.

Now I am off to a new set of problems in the “My Profile” page.
It works great for some member profiles but not for all.

  1. The file upload function is very inconsistent. It sometimes doesn’t post the files.
  2. Because this section is a file repository, it has to be “Read & Write” but the “Document Title” input field shows the last uploaded document whereas it should be clear.
  3. Sometimes file upload and member profile updates don’t show unless I refresh the browser.

I am too close to finishing the site and hiring another wix expert would not help me learn more and serve better as a wix expert myself. I might consider this if the issues linger for another few weeks.

Thanks for your responses.

Update
I separated the file upload and the file listing by placing them on two separate light boxes and using different datasets. This way one can be Read only and the other Write Only.
Now looking for ways to

  1. upload multiple files
  2. deleting uploaded files
  3. removing the time stamp from the Date & Time field.

Hi @info52 ,

I’ve tried uploading a file and it worked fine. Also I was able see the file in My Document right after uploading.

This post has become too lengthy. It’s hard to follow. I’d recommend you creating a new post for every single issue and attaching a screencast or exact steps to reproduce. That way more people may read your post and clearly understand the issue (if there are steps to reproduce or a screencast).

Thanks Yevhen.
Yes, I was able to resolve the issues. Thanks for the new thread suggestions. I’ll do that.

Hi,

I have created custom login page. It does logins for admin itself and one member more but it neither shows login errors nor does login for other members who already have signed up and their details are in same database.

It is working exactly on same way to reset password. It directs to reset password for 2 persons only, it does show ‘The email doesn’t match any account. Try again’ for rest.

Please help me to resolve it. Thanks

Hello,
I created a custom login page and I get the login and logoff option along with the my profile button, but the onclick function is not working. When you click on logout- nothing happens or when you click on my profile- nothing happens. I have it set up as a login page.

The login page has input fields - email and password plus 2 buttons- login and my profile. What could be the issue. Here is the code that I am using. Please help.
import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;
import wixLocation from ‘wix-location’ ;

$w.onReady( () => {
if (wixUsers.currentUser.loggedIn) {
$w( “#loginButton” ).label = “Logout” ;
$w( “#profileButton” ).show();
} else {
$w( “#loginButton” ).label = “Login” ;
$w( “#profileButton” ).hide();
}
} );

export function loginButton_click(event) {
// user is logged in
if (wixUsers.currentUser.loggedIn) {
// log the user out
wixUsers.logout()
.then( () => {
// update buttons accordingly
$w( “#loginButton” ).label = “Login” ;
$w( “#profileButton” ).hide();
} );
}
// user is logged out
else {
let userId;
let userEmail;

// prompt the user to log in
wixUsers.promptLogin( { “mode” : “login” } )
.then( (user) => {
userId = user.id;
return user.getEmail();
} )
.then( (email) => {
// check if there is an item for the user in the collection
userEmail = email;
return wixData.query( “Candidates” )
.eq( “_id” , userId)
.find();
} )
.then( (results) => {
// if an item for the user is not found
if (results.items.length === 0 ) {
// create an item
const toInsert = {
“_id” : userId,
“email” : userEmail
};
// add the item to the collection
wixData.insert( “Canidates” , toInsert)
. catch ( (err) => {
console.log(err);
} );
}
// update buttons accordingly
$w( “#loginButton” ).label = “Logout” ;
$w( “#profileButton” ).show();
} )
. catch ( (err) => {
console.log(err);
} );
}
}