login_routes.hpp (bd79bce8c3f1deb1fb2773868b9ece25233cf27b) login_routes.hpp (2ccce1f3a04ab72824820a6795878ce01f37a22c)
1#pragma once
2
3#include "app.hpp"
4#include "cookies.hpp"
5#include "http_request.hpp"
6#include "http_response.hpp"
7#include "multipart_parser.hpp"
8#include "pam_authenticate.hpp"

--- 139 unchanged lines hidden (view full) ---

148 {
149 // check if auth was provided as a headers
150 username = req.getHeaderValue("username");
151 password = req.getHeaderValue("password");
152 }
153
154 if (!username.empty() && !password.empty())
155 {
1#pragma once
2
3#include "app.hpp"
4#include "cookies.hpp"
5#include "http_request.hpp"
6#include "http_response.hpp"
7#include "multipart_parser.hpp"
8#include "pam_authenticate.hpp"

--- 139 unchanged lines hidden (view full) ---

148 {
149 // check if auth was provided as a headers
150 username = req.getHeaderValue("username");
151 password = req.getHeaderValue("password");
152 }
153
154 if (!username.empty() && !password.empty())
155 {
156 int pamrc = pamAuthenticateUser(username, password);
156 int pamrc = pamAuthenticateUser(username, password, std::nullopt);
157 bool isConfigureSelfOnly = pamrc == PAM_NEW_AUTHTOK_REQD;
158 if ((pamrc != PAM_SUCCESS) && !isConfigureSelfOnly)
159 {
160 asyncResp->res.result(boost::beast::http::status::unauthorized);
161 }
162 else
163 {
164 auto session =

--- 44 unchanged lines hidden ---
157 bool isConfigureSelfOnly = pamrc == PAM_NEW_AUTHTOK_REQD;
158 if ((pamrc != PAM_SUCCESS) && !isConfigureSelfOnly)
159 {
160 asyncResp->res.result(boost::beast::http::status::unauthorized);
161 }
162 else
163 {
164 auto session =

--- 44 unchanged lines hidden ---