Add Matrix authentication token form
This commit is contained in:
		
							
								
								
									
										8
									
								
								assets/style.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								assets/style.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| .body-content { | ||||
|     max-width: 700px; | ||||
|     margin: 50px auto; | ||||
| } | ||||
|  | ||||
| .body-content .card-header { | ||||
|     font-weight: bold; | ||||
| } | ||||
| @@ -31,6 +31,7 @@ pub async fn static_file(path: web::Path<String>) -> HttpResult { | ||||
| #[template(path = "index.html")] | ||||
| struct HomeTemplate { | ||||
|     name: String, | ||||
|     matrix_token: String, | ||||
| } | ||||
|  | ||||
| /// Main route | ||||
| @@ -55,7 +56,14 @@ pub async fn home(session: Session) -> HttpResult { | ||||
|  | ||||
|     Ok(HttpResponse::Ok() | ||||
|         .insert_header(("content-type", "text/html")) | ||||
|         .body(HomeTemplate { name: user.name }.render().unwrap())) | ||||
|         .body( | ||||
|             HomeTemplate { | ||||
|                 name: user.name, | ||||
|                 matrix_token: "TODO".to_string(), | ||||
|             } | ||||
|             .render() | ||||
|             .unwrap(), | ||||
|         )) | ||||
| } | ||||
|  | ||||
| #[derive(serde::Deserialize)] | ||||
|   | ||||
| @@ -6,6 +6,7 @@ | ||||
|     <link rel="icon" type="image/png" href="/assets/favicon.png"/> | ||||
|  | ||||
|     <link rel="stylesheet" href="/assets/bootstrap.css"/> | ||||
|     <link rel="stylesheet" href="/assets/style.css"/> | ||||
| </head> | ||||
| <body> | ||||
|  | ||||
| @@ -23,12 +24,48 @@ | ||||
|             </a> | ||||
|             <div class="navbar"> | ||||
|                 <span>Hi <span style="font-style: italic;">{{ name }}</span>  </span> | ||||
|                 <a  href="/sign_out">Sign out</a> | ||||
|                 <a href="/sign_out">Sign out</a> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
| </header> | ||||
|  | ||||
|  | ||||
| <div class="body-content"> | ||||
|     <!-- Matrix authentication token --> | ||||
|     <div class="card border-light mb-3"> | ||||
|         <div class="card-header">Matrix authentication token</div> | ||||
|         <div class="card-body"> | ||||
|             <p>To obtain a new Matrix authentication token:</p> | ||||
|             <ol> | ||||
|                 <li>Sign in to Element <strong>from a private browser window</strong></li> | ||||
|                 <li>Open <em>All settings</em> and access the <em>Help & About</em> tag</li> | ||||
|                 <li>Expand <em>Access Token</em> and copy the value</li> | ||||
|                 <li>Paste the copied value below</li> | ||||
|                 <li>Close the private browser window <strong>without signing out</strong>!</li> | ||||
|             </ol> | ||||
|  | ||||
|             <p>You should not need to replace this value unless you explicitly signed out the associated browser | ||||
|                 session.</p> | ||||
|  | ||||
|             <p>Tip: you can rename the session to easily identify it among all your other sessions!</p> | ||||
|  | ||||
|             <form action="/set_matrix_access_token"> | ||||
|                 <div> | ||||
|                     <label for="accessTokenInput" class="form-label mt-4">New Matrix access token</label> | ||||
|                     <input type="text" class="form-control" id="accessTokenInput" aria-describedby="tokenHelp" | ||||
|                            placeholder="{{ matrix_token }}" required minlength="2"/> | ||||
|                     <small id="tokenHelp" class="form-text text-muted">Changing this value will reset all active | ||||
|                         connections | ||||
|                         to Matrix Gateways.</small> | ||||
|                 </div> | ||||
|  | ||||
|                 <input type="submit" class="btn btn-primary" value="Update"/> | ||||
|             </form> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
|  | ||||
| </body> | ||||
| </html> | ||||
		Reference in New Issue
	
	Block a user