3 Commits

Author SHA1 Message Date
7f58c4b68b Added 2FA components
Some checks failed
Push Workflows / docker-build (push) Failing after 11s
Push Workflows / build (push) Failing after 1m50s
Push Workflows / docs (push) Successful in 1m54s
Push Workflows / test (push) Successful in 2m15s
Push Workflows / leptos-test (push) Successful in 3m56s
2024-12-11 04:02:24 +00:00
9fb3cd745b Merge pull request 'Fix Album Artists Displayed Wrong' (#165) from 164-album-artists-displayed-wrong into main
Some checks failed
Push Workflows / docs (push) Successful in 3m59s
Push Workflows / build (push) Failing after 4m9s
Push Workflows / test (push) Has been cancelled
Push Workflows / docker-build (push) Has been cancelled
Push Workflows / leptos-test (push) Has been cancelled
Reviewed-on: #165
Reviewed-by: Ethan Girouard <ethan@girouard.com>
2024-12-04 05:54:37 +00:00
a7905624a6 Bugfixes
Some checks failed
Push Workflows / docs (push) Successful in 3m4s
Push Workflows / test (push) Successful in 4m58s
Push Workflows / leptos-test (push) Successful in 7m7s
Push Workflows / build (push) Successful in 7m53s
Push Workflows / docker-build (push) Failing after 13m32s
2024-12-04 05:29:16 +00:00
2 changed files with 20 additions and 17 deletions

View File

@@ -542,24 +542,14 @@ impl Album {
pub fn get_album_data(album_id: i32, conn: &mut PgPooledConn) -> Result<AlbumData, Box<dyn Error>> {
use crate::schema::*;
let album: Vec<(Album, std::option::Option<Artist>)> = albums::table
.find(album_id)
.left_join(songs::table.on(albums::id.nullable().eq(songs::album_id)))
.left_join(song_artists::table.inner_join(artists::table).on(songs::id.eq(song_artists::song_id)))
.select((
albums::all_columns,
artists::all_columns.nullable()
))
.distinct()
let artist_list: Vec<Artist> = album_artists::table
.filter(album_artists::album_id.eq(album_id))
.inner_join(artists::table.on(album_artists::artist_id.eq(artists::id)))
.select(
artists::all_columns
)
.load(conn)?;
let mut artist_list: Vec<Artist> = Vec::new();
for (_, artist) in album {
if let Some(artist) = artist {
artist_list.push(artist);
}
}
// Get info of album
let albuminfo = albums::table
.filter(albums::id.eq(album_id))
@@ -671,7 +661,7 @@ impl Album {
// Sort the songs by date
let mut songdata: Vec<SongData> = album_songs.into_values().collect();
songdata.sort_by(|a, b| b.track.cmp(&a.track));
songdata.sort_by(|a, b| a.track.cmp(&b.track));
Ok(songdata)
}
}

View File

@@ -10,6 +10,7 @@ use crate::components::loading::Loading;
pub fn Login() -> impl IntoView {
let (username_or_email, set_username_or_email) = create_signal("".to_string());
let (password, set_password) = create_signal("".to_string());
let (two_fa_code, set_two_fa_code) = create_signal("".to_string());
let (show_password, set_show_password) = create_signal(false);
@@ -27,6 +28,8 @@ pub fn Login() -> impl IntoView {
let username_or_email1 = username_or_email.get();
let password1 = password.get();
let two_fa_code1 = two_fa_code.get();
spawn_local(async move {
loading.set(true);
error_msg.set(None);
@@ -106,6 +109,16 @@ pub fn Login() -> impl IntoView {
</Show>
</div>
<div class="input-box">
<input class="login-2fa" type="text" required
on:input = move |ev| {
set_two_fa_code(event_target_value(&ev));
log!("2FA code changed to: {}", two_fa_code.get());
}
/>
<span>2FA Code</span>
<i></i>
</div>
<a href="" class="forgot-pw">Forgot Password?</a>
<div class="error-msg" >{ move || error_msg.get() }</div>
<Show