1
0
Fork 0
mirror of https://gitlab.com/hagrid-keyserver/hagrid.git synced 2023-02-13 20:55:02 -05:00

fix links and redirect logic in upload

This commit is contained in:
Vincent Breitmoser 2019-02-22 21:38:38 +01:00
parent 1715c7834d
commit fde2b5ed73
6 changed files with 15 additions and 15 deletions

View file

@ -1,7 +1,7 @@
{{#> layout }}
{{> search-form}}
<div class="row">
<p>You can also <a href="/upload">upload</a> or <a href="/vks/manage">delete</a> your key.</p>
<p>You can also <a href="/vks/publish">upload</a> or <a href="/vks/manage">delete</a> your key.</p>
</div>
<div class="row">

View file

@ -2,7 +2,7 @@
<p>After uploading you key we will send a verification link to every email address we find inside. Clicking that link will make your key searchable by this email address.</p>
<div class="row">
<form action="/upload/add" method=POST enctype=multipart/form-data>
<form action="/vks/publish/submit" method=POST enctype=multipart/form-data>
<div class="upload">
<input type="hidden" name="csrf" value="{{csrf}}" />
<input type="file" id="keytext" name="keytext" autofocus class="fileUpload" placeholder="Your public key"/>
@ -15,11 +15,11 @@
<div class="row">
<p>If you're using GnuPG you can use the following snipped to export you public key. This will create a file called mykey.pgp that you can upload here.</p>
<pre><code>gpg --export your-address@example.org &gt; mykey.pgp</code></pre>
<pre><code>gpg --export your_address@example.org &gt; mykey.pgp</code></pre>
</div>
<div class="row">
<p>You can delete an uploaded key <a href="/delete">here</a>.</p>
<p>You can delete an uploaded key <a href="/vks/manage">here</a>.</p>
</div>
<script>

View file

@ -570,8 +570,8 @@ pub fn serve(opt: &Opt, db: Polymorphic) -> Result<()> {
by_keyid,
// HKP
lookup,
upload::upload_landing,
upload::upload_hkp,
upload::vks_publish,
upload::vks_publish_submit,
// verification & deletion
verify,
delete,

View file

@ -39,8 +39,8 @@ mod template {
}
}
#[get("/upload")]
pub fn upload_landing(
#[get("/vks/publish")]
pub fn vks_publish(
flash: Option<FlashMessage>
) -> Template {
if let Some(flash) = flash {
@ -53,7 +53,7 @@ pub fn upload_landing(
commit: env!("VERGEN_SHA_SHORT").to_string(),
};
Template::render("upload_ok", context)
Template::render("vks_publish_ok", context)
}
_ => show_error(flash.msg().to_owned())
}
@ -63,7 +63,7 @@ pub fn upload_landing(
commit: env!("VERGEN_SHA_SHORT").to_string(),
};
Template::render("upload", context)
Template::render("vks_publish", context)
}
}
@ -74,17 +74,17 @@ fn show_error(error: String) -> Template {
commit: env!("VERGEN_SHA_SHORT").to_string(),
};
Template::render("upload_err", context)
Template::render("vks_publish_err", context)
}
#[post("/upload/add", data = "<data>")]
pub fn upload_hkp(
#[post("/vks/publish/submit", data = "<data>")]
pub fn vks_publish_submit(
db: State<Polymorphic>, cont_type: &ContentType, data: Data,
tmpl: State<MailTemplates>, domain: State<Domain>, from: State<From>
) -> Flash<Redirect> {
match do_upload_hkp(db, cont_type, data, tmpl, domain, from) {
Ok(ok) => ok,
Err(err) => Flash::error(Redirect::to("/upload"), err.to_string()),
Err(err) => Flash::error(Redirect::to("/vks/publish?err"), err.to_string()),
}
}
@ -199,5 +199,5 @@ where
}
let json = serde_json::to_string(&results).unwrap();
Ok(Flash::success(Redirect::to("/upload"), json))
Ok(Flash::success(Redirect::to("/vks/publish?ok"), json))
}