Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic Authentication and Authorization example #161

Closed
mnesarco opened this issue Dec 29, 2023 · 4 comments
Closed

Basic Authentication and Authorization example #161

mnesarco opened this issue Dec 29, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@mnesarco
Copy link

Hi Friends,
Here I am sharing an example of how to manage authentication and authorization:
https://github.com/mnesarco/sqlpage_auth_example

I use Postgresql and stored procedures to avoid code duplication as much as possible as include directive is not yet available in SQLPage.

Ref: #20

As I am new to SQLPage, it would be great to have some feedback. Maybe I am not following best practices or I am just reinventing the wheel.

@mnesarco mnesarco added the enhancement New feature or request label Dec 29, 2023
@DSMejantel
Copy link

Hello,
You can see my example on my github repository.

With the help from lovasoa, i build my page so with authentification and restriction acces :

`SELECT 'redirect' AS component,
'signin.sql?error' AS link
WHERE NOT EXISTS (SELECT 1 FROM login_session WHERE id=sqlpage.cookie('session'));
SET group_id = (SELECT user_info.groupe FROM login_session join user_info on user_info.username=login_session.username WHERE id = sqlpage.cookie('session'));

SELECT 'redirect' AS component,
'index.sql?restriction' AS link
WHERE $group_id<'2';`

@lovasoa
Copy link
Collaborator

lovasoa commented Dec 29, 2023

I will add links to both your examples to the readme

@mnesarco
Copy link
Author

Hi @DSMejantel
Impressive example, thank you. I have a lot of things to learn from it. My example is only about Authentication and Authorization and reducing code duplication on every page.

@DSMejantel
Copy link

Hello,
I propose a new version with my last commit for the authencation with an 'activation key' at the first time.
Then key is deleted when user has created his own password.
If password is lost, Admin can edit a new key and the forgotten password will be deleted.
So it will be easier to import vie csv file a lot of user with different key (and no more hash_password)

@sqlpage sqlpage locked and limited conversation to collaborators May 23, 2024
@lovasoa lovasoa converted this issue into discussion #335 May 23, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants