login url
LOGIN_URL = 'your_url'
wordpress set two login url links
<?php
//if you want to show two (different) login pages for two (different) links,
//you can first of all think of two urls for two different login pages.
//here, i have two links => /login-old and /login-new for which i want different forms,
//now as any of these url hits the browser, i will check for url paramenter
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (strpos($url,'login-new') !== false) {
// echo 'to New Login page';
$cookie_name = "login_page";
$cookie_value = "new";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); //will not set immediately, but useful later for logout
header("Location: ".site_url('login')); //this will be your default login page url
exit;
} else if(strpos($url,'login-old') !== false) {
// echo 'to Old Login page';
$cookie_name = "login_page";
$cookie_value = "old";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); //will not set immediately, but useful later for logout
header("Location: ".site_url('login'));
exit;
}
//now that the cookie is set, i know which form to show to user,
//now, as the user gets redirected to default login page, go to it's template file
//and check for the default login form, where, check,
$login_page = '';
if (isset($_COOKIE['login_page'])) {
$login_page = $_COOKIE['login_page'];
}
if ($login_page == 'new') { ?>
<style>
#your new form styling here...
</style>
<?php } else if ($login_page == 'old'){ ?>
<style>
#your old form styling here...
</style>
<?php }
if ($login_page == 'new') { ?>
<form id="new_form" action="" method="post"> </form>
<?php } else if ($login_page == 'old'){ ?>
<form id="old_form" action="" method="post"> </form>
<?php }
//here, check the default login form action attr to put above in our custom forms
login urls
from knox import views as knox_views
from .views import LoginAPI
from django.urls import path
urlpatterns = [
path('api/login/', LoginAPI.as_view(), name='login'),
path('api/logout/', knox_views.LogoutView.as_view(), name='logout'),
path('api/logoutall/', knox_views.LogoutAllView.as_view(), name='logoutall'),
]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us