Lekhoniya lekhoniya.com Subham Mandal Dhupguri ONE Code ONE ssss web West Bengal India Bangla writing pad Bengali type লেখনীয়া
লেখনীয়া
progarammed by Subham Mandal

User Authentication and Authorization of Lekhoniya : Empowering Content Management

 

User Authentication and Authorization of Lekhoniya : Empowering Content Management

Introduction

Empower content management with the User Authentication and Authorization script, a sophisticated creation by the developer Subham Mandal. Seamlessly integrated into the web application Lekhoniya, and aligned with the brand name onessssweb, this script ensures secure and personalized content management through user authentication and authorization.

Overview

User Authentication

The checkLocalStorage function checks if a user is present in the local storage. If not, it creates a new user using the newUser function.

function checkLocalStorage() {
    ini();
    let userName = localStorage.getItem('lekhoniya-user');
    console.log('User: ' + userName);
    if (userName == null) {
        newUser();
    } else {
        document.getElementById('usercheck').value = userName;
    }
    authority();
}

New User Creation

The newUser function creates a new user by generating a unique identifier based on the current timestamp and additional device information.

function newUser() {
    const firstParenthesesMatch = navigator.userAgent.match(/\((.*?)\)/);
    const did = firstParenthesesMatch[1].replace(/ /g, "").replace(/;/g, "-");

    let userName = Date.now() + '-' + did;
    localStorage.setItem('lekhoniya-user', userName);
    document.getElementById('usercheck').value = userName;
    checkLocalStorage();
    firebase.database().ref("lekhoniya_user").push(userName);
    document.getElementById('who').value = 'Author: ' + userName;
}

User Authorization

The authority function compares the main user and check user. If they match, it allows updates; otherwise, it designates the authority as 'Server'.

function authority() {
    let usermain = document.getElementById('usermain').value;
    let usercheck = document.getElementById('usercheck').value;

    if (usermain == usercheck) {
        document.getElementById('online').innerHTML = 'Update';
    } else {
        document.getElementById('online').innerHTML = 'Server';
    }
}

Usage Instructions

  1. User Authentication: The script checks and creates a new user if needed, ensuring personalized content management.

  2. User Authorization: The script authorizes users based on their credentials, allowing updates or designating authority to the server.

Conclusion

User Authentication and Authorization, crafted by the skilled Subham Mandal, fortifies content management within Lekhoniya. Seamlessly integrated with the brand name onessssweb, this script ensures secure and personalized content experiences by authenticating users and authorizing updates.

For inquiries, suggestions, or enhancements related to this script, feel free to connect with Subham Mandal. Elevate your content management with the robust user authentication and authorization features of Lekhoniya!