Comments (4)
Hello,
putting data in session impossible. I checked it's not big data.
Not giving any error.
Could you help me, please?
session.put('user-data', authResponse.body);
session.put('user-data2', "12345");//for this one not working
from session.
Hello @thetutlage,
Could you help me, please?
from session.
Hey @Sunedge! 👋
Could you please be more descriptive of what you are trying to do, what happen and what you expect to happen.
Also, a repository to reproduce your issue would be great.
from session.
Hi @RomainLanz,
I want to put variables into session.
session.put('user-data', authResponse.body);
My data's size is 400 bytes. If user-data size increased it not working and not login.
The Problem is size of session (user-data).
If it's possible increase size session, how can I do it?
Please look at session.put('user-data', authResponse.body); line
Best regards.
//It's my code bellow
'use strict'
const Env = use('Env');
class AuthController {
async login({view,request,response,session,antl}) {
if (request.method() == "POST") {
try {
session.clear();
const username = request.input('username');
const password = request.input('password');
const loginClient = use('sync-rest-client');
const authResponse = await
loginClient.post(Env.get('SAAS_SERVER_URL') + '/auth/login', {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
payload: "username=" + username + "&password=" + password
});
if(authResponse.statusCode==200){
session.put('user-data', authResponse.body);
const restClient = use('sync-rest-client');
const menuDataResp = await
restClient.post(Env.get('SAAS_SERVER_URL') + '/users/profile/menuDataByUserPermission', {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer ' + (session.get('user-data') ? session.get('user-data').access_token : '')
}
});
session.put("menu-data",menuDataResp.body);
response.redirect('/user/auto');
} else if(authResponse.statusCode==401) {
return view.render("user.login",{errors:antl.formatMessage('errors.auth_error')})
} else if(authResponse.statusCode==500) {
return view.render("user.login",{errors:antl.formatMessage('errors.auth_error_server')})
}
} catch (e) {
return view.render("user.login",{errors:antl.formatMessage('errors.auth_error_server')})
}
} else {
return view.render('user.login', {errors: null})
}
}
async logout({response,session}) {
session.forget('user-data');
return response.redirect('/login');
}
}
module.exports = AuthController
from session.
Related Issues (14)
- Action required: Greenkeeper could not be activated 🚨
- Deserializing ObjectID to ObjectId make wrong user login on adonis HOT 11
- numerous number of files reside on session folder HOT 4
- Store a copy of flash messages to be accessed from route
- expires on session put HOT 1
- Disable session creation on certain routes HOT 4
- Missing bson dependancy HOT 2
- Installing @Adonisjs/session doesn't work so adonis auth doesn't work
- Flash message not working
- a new session file for each new request from mobile app HOT 7
- Property `session` does not exist on type `HttpContextContract` HOT 4
- Export `values_store` types to help using flash messages with tsx HOT 2
- Error: RuntimeException: E_RUNTIME_ERROR: Session store is not initiated yet HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from session.