|
@@ -162,7 +162,7 @@ const char *login_page = ""
|
|
|
"<!DOCTYPE html>\n"
|
|
|
"<body><h1>%s OAuth identify</h1>\n"
|
|
|
"<div style=\"background-color: red; color: white\">%s</div>\n"
|
|
|
-"<form method=\"post\" action=\"https:/" "/%s/oauth/x-snac-login\">\n"
|
|
|
+"<form method=\"post\" action=\"https:/" "/%s/%s\">\n"
|
|
|
"<p>Login: <input type=\"text\" name=\"login\"></p>\n"
|
|
|
"<p>Password: <input type=\"password\" name=\"passwd\"></p>\n"
|
|
|
"<input type=\"hidden\" name=\"redir\" value=\"%s\">\n"
|
|
@@ -208,7 +208,8 @@ int oauth_get_handler(const xs_dict *req, const char *q_path,
|
|
|
if (xs_is_null(state))
|
|
|
state = "";
|
|
|
|
|
|
- *body = xs_fmt(login_page, host, "", host, ruri, cid, state, USER_AGENT);
|
|
|
+ *body = xs_fmt(login_page, host, "", host, "oauth/x-snac-login",
|
|
|
+ ruri, cid, state, USER_AGENT);
|
|
|
*ctype = "text/html";
|
|
|
status = 200;
|
|
|
|
|
@@ -264,7 +265,8 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
|
|
|
const char *host = xs_dict_get(srv_config, "host");
|
|
|
|
|
|
|
|
|
- *body = xs_fmt(login_page, host, "LOGIN INCORRECT", host, redir, cid, state, USER_AGENT);
|
|
|
+ *body = xs_fmt(login_page, host, "LOGIN INCORRECT", host, "oauth/x-snac-login",
|
|
|
+ redir, cid, state, USER_AGENT);
|
|
|
*ctype = "text/html";
|
|
|
status = 200;
|
|
|
|
|
@@ -273,8 +275,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path,
|
|
|
|
|
|
if (user_open(&snac, login)) {
|
|
|
|
|
|
- if (check_password(login, passwd,
|
|
|
- xs_dict_get(snac.config, "passwd"))) {
|
|
|
+ if (check_password(login, passwd, xs_dict_get(snac.config, "passwd"))) {
|
|
|
|
|
|
xs *code = random_str();
|
|
|
|