formatting

This commit is contained in:
Cadey Ratio 2020-10-28 13:28:21 -04:00
parent e638075cd1
commit b9b3347dc2
3 changed files with 7 additions and 9 deletions

View File

@ -16,8 +16,7 @@ pub struct User {
}
pub fn user(token: String) -> std::io::Result<User> {
let resp =
ureq::get("https://tulpa.dev/api/v1/user")
let resp = ureq::get("https://tulpa.dev/api/v1/user")
.set("Authorization", &format!("bearer {}", token))
.call();
if !resp.ok() {

View File

@ -1,13 +1,13 @@
use crate::{MainDatabase, models, schema};
use crate::{models, schema, MainDatabase};
use color_eyre::eyre::{eyre, Result};
use diesel::prelude::*;
use hmac::{Hmac, NewMac};
use jwt::{SignWithKey, VerifyWithKey};
use lazy_static::lazy_static;
use std::env;
use hmac::{Hmac, NewMac};
use sha2::Sha256;
use std::collections::BTreeMap;
use std::env;
lazy_static! {
pub static ref SECRET: String = env::var("JWT_SECRET")
@ -15,7 +15,6 @@ lazy_static! {
.to_string();
}
#[tracing::instrument]
pub fn make(user_id: uuid::Uuid, token_id: uuid::Uuid) -> Result<String> {
let key: Hmac<Sha256> = Hmac::new_varkey(&*SECRET.as_bytes()).unwrap();

View File

@ -1,4 +1,4 @@
use crate::schema::{gitea_tokens, users, tokens};
use crate::schema::{gitea_tokens, tokens, users};
use chrono::NaiveDateTime;
use serde::Serialize;
use uuid::Uuid;
@ -26,7 +26,7 @@ pub struct User {
}
#[derive(Insertable)]
#[table_name="gitea_tokens"]
#[table_name = "gitea_tokens"]
pub struct NewGiteaToken {
pub user_id: Uuid,
pub access_token: String,
@ -44,7 +44,7 @@ pub struct GiteaToken {
}
#[derive(Insertable)]
#[table_name="tokens"]
#[table_name = "tokens"]
pub struct NewToken {
pub user_id: Uuid,
}