The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
handle existing join+login page
#1
Hi mudmin,

how do i replace an existing user management script that handles a page which already has its graphic design, that has both JOIN and LOGIN forms on it, with UserSpice?


yuma
  Reply
#2
The simplest thing to me would be to just use our login/join logic. In other words, you don't need to use our actual login.php form, but if you use your own form,just have it use the php that we use to do the actual logging in. Then each page just needs the init file and the securePage function.
  Reply
#3
Cool !I hope this is what I think it is. A custom register and login page? If yes how do we handle the google and Facebook login feature on d custom form .
  Reply
#4
Dealing with google/fb might be the easiest part of it because we do those with their own includes. So let's take a look.

Let's say you have

mydomain.com
mydomain.com/youroldfiles
mydomain.com/users (The bulk of the userspice files)

Let's say you have your login page (just for reference at)
mydomain.com/youroldfiles/yourlogin.php

If you open OUR login.php file and go to lines 117-124, you'll see that just above our actual login form, we have

Code:
<?php
Code:
if($settings->glogin==1 && !$user->isLoggedIn()){
Code:
require_once $abs_us_root.$us_url_root.'users/includes/google_oauth_login.php';
Code:
}
Code:
if($settings->fblogin==1 && !$user->isLoggedIn()){
Code:
require_once $abs_us_root.$us_url_root.'users/includes/facebook_oauth.php';
Code:
}
Code:
?>

That is all of our fb/google logic being included. So you could put that on your own login form in one of two ways...
1. Change the require once statements to "back out" of your folder and go over to the UserSpice folder.
Code:
require_once '../users/includes/google_oauth_login.php';

2. Put in the full url
Code:
require_once 'http://mydomain.com/users/includes/google_oauth_login.php';

I hope that helps.
  Reply
#5
Working well! I tried to take it to the next level . I used ajax tabs for login ,register and forgot password. I hope to achieve page navigation without reloading . (I hope this is added in US5) it all worked well until when user type wrong password ,email etc. I get redirected to the main join.php and login.php
  Reply
#6
I'm terrible at Ajax so I'm probably not much help.
  Reply
#7
What if I want to combine login.php with join.php?

I copied join.php logic to login.php and added _join.php view to the login.php. Next I changed $form_action ='join.php' to $form_action = 'login.php', so when I click register button I'm not sended away to join.php anymore.

Now here I'm stuck with some problems. If I now try to login OR register, I get Token doesn\'t match! message, after I click on login or register button.

I have tried to delete this line '<input type="hidden" value="<?=Token::generate();?>" name="csrf">' from login.php AND/OR from _join.php. I have tryed to rename tokens (from name="csrf" to name="csrf2") with no success. I have tried to comment out previous line of code and commented out the php logic that throws this error. But either way, the forms aren't working, or is only working one of them (either register or login).

@mudmin: can I somehow send you an PM?
  Reply
#8
Sure. I sent you an email asking you to pastebin your attempt at it and I will take a look.
  Reply
#9
Pastebin for login.php and _join.php

Site is online at oblak.ersim.si

Thanks!
  Reply
#10
I'm making some progress on this, but I'm going to be gone for the day, so it will be a bit till I can get back to you.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)