Skip to content

Commit 8fd7bc8

Browse files
fix(dummy): add submit button to sign in form
1 parent c3bc8a3 commit 8fd7bc8

File tree

1 file changed

+27
-14
lines changed
  • packages/methods/shield-dummy/src/actions

1 file changed

+27
-14
lines changed

packages/methods/shield-dummy/src/actions/sign_in.rs

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ use std::sync::Arc;
33
use async_trait::async_trait;
44
use serde::Deserialize;
55
use shield::{
6-
Action, ActionMethod, Form, Input, InputType, InputTypeText, MethodSession, Request, Response,
7-
ResponseType, SessionAction, ShieldError, SignInAction, Storage, User, erased_action,
6+
Action, ActionMethod, Form, Input, InputType, InputTypeSubmit, InputTypeText, InputValue,
7+
MethodSession, Request, Response, ResponseType, SessionAction, ShieldError, SignInAction,
8+
Storage, User, erased_action,
89
};
910

1011
use crate::provider::DummyProvider;
@@ -49,18 +50,30 @@ impl<U: User + 'static> Action<DummyProvider, ()> for DummySignInAction<U> {
4950

5051
async fn forms(&self, _provider: DummyProvider) -> Result<Vec<Form>, ShieldError> {
5152
Ok(vec![Form {
52-
inputs: vec![Input {
53-
name: "userId".to_owned(),
54-
label: Some("User ID".to_owned()),
55-
r#type: InputType::Text(InputTypeText {
56-
placeholder: Some("User ID".to_owned()),
57-
required: Some(true),
58-
..Default::default()
59-
}),
60-
value: None,
61-
addon_start: None,
62-
addon_end: None,
63-
}],
53+
inputs: vec![
54+
Input {
55+
name: "userId".to_owned(),
56+
label: Some("User ID".to_owned()),
57+
r#type: InputType::Text(InputTypeText {
58+
placeholder: Some("User ID".to_owned()),
59+
required: Some(true),
60+
..Default::default()
61+
}),
62+
value: None,
63+
addon_start: None,
64+
addon_end: None,
65+
},
66+
Input {
67+
name: "submit".to_owned(),
68+
label: None,
69+
r#type: InputType::Submit(InputTypeSubmit::default()),
70+
value: Some(InputValue::String {
71+
value: "Sign in with dummy".to_owned(),
72+
}),
73+
addon_start: None,
74+
addon_end: None,
75+
},
76+
],
6477
}])
6578
}
6679

0 commit comments

Comments
 (0)