mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-12-20 15:11:45 +03:00
Merge branch 'jf/invite' of github.com:uqbar-dao/uqbar into jf/invite
This commit is contained in:
commit
59c18ecdbb
@ -84,7 +84,7 @@ pub async fn register(
|
|||||||
|
|
||||||
async fn handle_get(
|
async fn handle_get(
|
||||||
our_get: Arc<Mutex<Option<Identity>>>,
|
our_get: Arc<Mutex<Option<Identity>>>,
|
||||||
networking_keypair_post: Arc<Mutex<Option<Document>>>
|
networking_keypair_post: Arc<Mutex<Option<Document>>>,
|
||||||
) -> Result<impl Reply, Rejection> {
|
) -> Result<impl Reply, Rejection> {
|
||||||
// 1. Generate networking keys
|
// 1. Generate networking keys
|
||||||
let (public_key, serialized_networking_keypair) = keygen::generate_networking_key();
|
let (public_key, serialized_networking_keypair) = keygen::generate_networking_key();
|
||||||
@ -107,7 +107,6 @@ async fn handle_get(
|
|||||||
|
|
||||||
// return response containing networking information
|
// return response containing networking information
|
||||||
Ok(warp::reply::json(&our))
|
Ok(warp::reply::json(&our))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_post(
|
async fn handle_post(
|
||||||
@ -117,7 +116,6 @@ async fn handle_post(
|
|||||||
networking_keypair: Document,
|
networking_keypair: Document,
|
||||||
_redir_port: u16,
|
_redir_port: u16,
|
||||||
) -> Result<impl Reply, Rejection> {
|
) -> Result<impl Reply, Rejection> {
|
||||||
|
|
||||||
our.name = info.username;
|
our.name = info.username;
|
||||||
|
|
||||||
let seed = SystemRandom::new();
|
let seed = SystemRandom::new();
|
||||||
@ -126,7 +124,7 @@ async fn handle_post(
|
|||||||
|
|
||||||
let token = match generate_jwt(&jwt_secret, our.name.clone()) {
|
let token = match generate_jwt(&jwt_secret, our.name.clone()) {
|
||||||
Some(token) => token,
|
Some(token) => token,
|
||||||
None => return Err(warp::reject())
|
None => return Err(warp::reject()),
|
||||||
};
|
};
|
||||||
let cookie_value = format!("uqbar-auth_{}={};", &our.name, &token);
|
let cookie_value = format!("uqbar-auth_{}={};", &our.name, &token);
|
||||||
let ws_cookie_value = format!("uqbar-ws-auth_{}={};", &our.name, &token);
|
let ws_cookie_value = format!("uqbar-ws-auth_{}={};", &our.name, &token);
|
||||||
@ -143,7 +141,6 @@ async fn handle_post(
|
|||||||
headers.append(SET_COOKIE, HeaderValue::from_str(&ws_cookie_value).unwrap());
|
headers.append(SET_COOKIE, HeaderValue::from_str(&ws_cookie_value).unwrap());
|
||||||
|
|
||||||
Ok(response)
|
Ok(response)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Serve the login page, just get a password
|
/// Serve the login page, just get a password
|
||||||
|
Loading…
Reference in New Issue
Block a user