Add providers buttons on login page
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-04-25 14:02:23 +02:00
parent 92d04f3312
commit a0325fefbf
4 changed files with 54 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ use actix::Addr;
use actix_identity::Identity;
use actix_web::{web, HttpRequest, HttpResponse, Responder};
use askama::Template;
use std::sync::Arc;
use crate::actors::bruteforce_actor::BruteForceActor;
use crate::actors::users_actor::{LoginResult, UsersActor};
@@ -12,6 +13,7 @@ use crate::controllers::base_controller::{
};
use crate::data::action_logger::{Action, ActionLogger};
use crate::data::login_redirect::LoginRedirect;
use crate::data::provider::{Provider, ProvidersManager};
use crate::data::remote_ip::RemoteIP;
use crate::data::session_identity::{SessionIdentity, SessionStatus};
use crate::data::user::User;
@@ -30,6 +32,7 @@ struct BaseLoginPage<'a> {
struct LoginTemplate<'a> {
_p: BaseLoginPage<'a>,
login: String,
providers: Vec<Provider>,
}
#[derive(Template)]
@@ -77,6 +80,7 @@ pub struct LoginRequestQuery {
#[allow(clippy::too_many_arguments)]
pub async fn login_route(
remote_ip: RemoteIP,
providers: web::Data<Arc<ProvidersManager>>,
users: web::Data<Addr<UsersActor>>,
bruteforce: web::Data<Addr<BruteForceActor>>,
query: web::Query<LoginRequestQuery>,
@@ -121,7 +125,7 @@ pub async fn login_route(
query.redirect.get_encoded()
));
}
// Check if the user has to valide a second factor
// Check if the user has to validate a second factor
else if SessionIdentity(id.as_ref()).need_2fa_auth() {
return redirect_user(&format!(
"/2fa_auth?redirect={}",
@@ -203,6 +207,7 @@ pub async fn login_route(
redirect_uri: &query.redirect,
},
login,
providers: providers.cloned(),
}
.render()
.unwrap(),